Link to home
Start Free TrialLog in
Avatar of dtyson69
dtyson69Flag for United States of America

asked on

Need help using jquery ajax on https site.

Hello all,

My site was working fine under the regular http site.  When i was force to move over to secure https site, ajax stop working.  I don't know what i am doing wrong.

the code is below:
				$.ajax({
				type: "POST",
				url: "update_location.php",
				data:'vlat='+locLat+'&vlong='+locLong+'&vTranId='+tranId,
				success: function(data){
					$("#city-list").html(data);
                                      
				}
				});

Open in new window

Avatar of Kim Walker
Kim Walker
Flag of United States of America image

It appears that you are using a relative URL in your ajax connection. Did you move your update_location.php script to the secure https site as well?

If not, you would need to use an absolute URL. However, if the update_location.php file and the web site are not under the same domain, cross-domain blocking will occur unless the server is configured to allow cross-domain requests. Also, if the update_location.php file is not in a secured location too, the browser will block the ajax request from the secured page.
Avatar of Julian Hansen
Also check your console for errors (F12)
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.