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
64 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
  • 3
  • 3
7 Comments
 
LVL 76

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 76

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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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 76

Accepted Solution

by:
arnold earned 500 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 33

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now