Ajax call forces redirect from HTTPS to HTTP return 302

Description:

Calling an Ajax request from a HTTPS server redirects to the HTTP server causing a 302 redirect return message if the HTTP and HTTPS servers are on different IPs.

Solution:

Ajax calls through JavaScript will always redirect to HTTP. To remain on the first server, or to return the 200 status regarding of the server, we have to use jQuery Ajax calls.

Also the call is much more simpler, faster and precise:

$(“#load_get”).click(function(){
$(“#result”)
.html(ajax_load)
.load(loadUrl, “getvalues.php=php&id=5”);
});

About admin

Just another php developer trying to give something back to the community.
This entry was posted in PhP, Script and tagged , . Bookmark the permalink.

Leave a comment