December 29, 20169 yr Hi All, I've been completely stumped by this issue - hopefully one of you guys can help me?Firstly, this script is running completely fine on my live site (i.e. on my paid hosting). I'm trying to get the site working on my own machine so that I can make updates easily without it affecting live clients.... so I have installed xampp and connected the site via remote mysql connection - so far so good!until I hit this.... I use a lot of ajax on my system... but it's not working properly on my local machine. Note from the server this works perfectly. The Code: xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4) { alert("status " + xmlhttp.status + " - address was: " + address); } } xmlhttp.open("GET", address + "&refresh=" + (new Date().getTime()), true); //time is added in to ensure every request is a unique and up-to-date result. The alert box result I get is this:status 301 - address was: ajax_detectDevice.php?action=findDevice&deviceId=58657b5b82e263.00784914When I click the link in the page inspection / console (which displays as:) http://localhost/esmie/studentRegister/ajax_detectDevice.php?action=findDevice&deviceId=58657b5b82e263.00784914&refresh=1483049862651 I get exactly the result I would expect when the page loads loadIndexPage(); (the above is evaluated by the javascript when it is returned which initiates another javascript function)Does anyone have any clues why I am getting a 301 redirection error and not the 200 ok status I would normally expect?Thanks for any help or hints anyone can provide. Edited December 29, 20169 yr by webbhost
December 29, 20169 yr Author Also, if I change the address so that it reads something that is 'incorrect' - it returns 404 which I would expect.... so it's definitely finding the page... it's just redirecting rather than executing the script?
December 30, 20169 yr Author Figured this one out in the end.... the problem was with the ajax script, not the javascript in itself.My php file it was locating had a check for HTTPS within the globalstart.php settings loader... as it doesn't detect https on localhost, it was constantly redirecting... oops!thanks anyway for anyone that took a look.
Create an account or sign in to comment