Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

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.

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?
Avatar of arnold
arnold
Flag of United States of America image

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.
Avatar of BR

ASKER

it doesn't work on the server,

updateData(this) is not working
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.
Avatar of BR

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BR

ASKER

thank you very much
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