?
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
?
80 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 79

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 79

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 79

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

Independent Software Vendors: 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!

Question has a verified solution.

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

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
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

764 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