Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Above article was working since I had SSL sertificate. I now use https instead of http, I think that's why it's not working.

Posted on 2016-09-26
7
Medium Priority
?
84 Views
Last Modified: 2016-09-27
I had this question after viewing Using a drop down box to populate a second drop down box.

Above article was working since I had SSL sertificate. I now use https instead of http, I think that's why it's not working.
what should I do?
should I modify the code?
0
Comment
Question by:Braveheartli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 80

Expert Comment

by:arnold
ID: 41817301
The mode of connection is likely not the issue, double check the action on the form to make sure it corresponds to the way data is accessed.
I.e if your setup requires secure access (https://) make sure your <form action= points to https as the destination mode of data submission.
0
 
LVL 1

Author Comment

by:Braveheartli
ID: 41817345
it doesn't work on the server,

updateData(this) is not working
0
 
LVL 80

Expert Comment

by:arnold
ID: 41817820
Saying something is not working provides no insight.
You are using jquery, can you double check whether all your jquery calls use the https:// connection back to your servers
Check the site's log for the call to see if it came in over https or http

Double check the directory https config points to has the ... As exists in the prior.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Braveheartli
ID: 41817921
thank you
I use this <script src="http://code.jquery.com/jquery-latest.js"></script> j query

Should I save the jquery-latest.js file and change all http to https?
0
 
LVL 80

Accepted Solution

by:
arnold earned 2000 total points
ID: 41818042
Since you added the certificate, did you reconfigure your system to no longer answer requests on http://
Often when a secure page has mixed data sources (secure/insecure) it notifies the user and the user may choose not to load the insecure data at which point your javascript source will not be seen by the browser.

Yes, secure pages should reference all their content through the secure channel to avoid alerts to user that some content is other and whether they wish to only load secure or all content..
0
 
LVL 1

Author Closing Comment

by:Braveheartli
ID: 41818112
thank you very much
0
 
LVL 34

Expert Comment

by:Slick812
ID: 41818137
greetings Braveheartli, , I looked at this article -
       https://www.experts-exchange.com/articles/18556/Using-a-drop-down-box-to-populate-a-second-drop-down-box.html

which seems to be the base for this question? ?
You do NOT have any jquery AJAX error catching code in that, so you do NOT get any info about the javascript that causes the code to fail. You can place the jquery -
       $(document).ajaxError( )
method in your code to get the jquery variety of error parameters to show what happened for the failure, the jquery API for that ajaxError method is here -
       http://www.w3schools.com/jquery/ajax_ajaxerror.asp

and can be coded i this fashion -
$(document).ajaxError(function( event, request, settings, exc ) {
if (request.status==404) alert("ERROR from Ajax as '404 status' the "+settings.url+" page was NOT on Server, \nCan NOT recover from this ERROR, This operation is NOT available!"); 
else {
alert("ERROR from Ajax POST= Server-Status: "+request.status+", post-URL: "+settings.url+", post-Data: "+settings.data+", error because: "+exc);
if (request.responseText) {
  $('#debug1').html(request.responseText); 
  }else $('#debug1').html("ajaxError responseText is empty");
}
});

Open in new window

I use a development <div> ID debug1  to show the returned server TEXT, but you can change it to the development console log.

another way is to use the jquery AJAX done and fail methods something like -
<script>
var count = 1;

function doAjax(ele){
var postRe = $.post( "eepostaj.php", {n: $("#in1").val, c: count } );

postRe.done(function( received ) {
$( "#ajReturn" ).append( "<br/>"+received );
});


postRe.fail(function(xhr, error1, err) {// the Status IS NOT a Number, but the Type of jquery ERROR
  if (xhr.status==404) alert("ERROR from Ajax as '404 status' the "+ajxSend.url+" page was NOT on Server, \nCan NOT recover from this ERROR, This operation is NOT available!");
  else {
  alert("Ajax ERROR = \""+error1+"\", with server Status: "+xhr.status+", \nerror because: "+err);
  if (aj.responseText) {
    console.log("AJAX ERROR TEXT: "+aj.responseText); 
    }else console.log("AJAX ERROR TEXT: Ajax Received Text is empty");
  }
  });

count++;
}
</script>

Open in new window


the use of the -
     http://code.jquery.com/jquery-latest.js
is Out Of Date , and should not be used any more, due to the ever continuing development and changes to the jquery build, the LATEST could NOT be maintained, so a developer now has to load the Jquery version appropriate to there code write, I would recommend using the jquery new 2 version at -
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

also, you should try the FULL php web addy in the post( ) method maybe like -
jQuery.post("https://domain.com/ajax/getResult.php","type="+value,updateNumber);

to be sure that the SSL connection of "https" is used for the ajax address
1

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question