RJ Solusoft

This article is all about how to get jQuery AJAX cross-site calls working correctly. It assumes that you operate the server that the cross-site AJAX code is communicating to.

When configuring jQuert AJAX calls to work across different servers we kept getting the error “a is null” in the jQuery AJAX response. In particluar I was trying to get the AJAX call to work using XML as the communication method. After looking around online for a bit we found lots of cross site solutions ranging from using jquery json variations instead through to setting up some proxy code in PHP to grab the response for you.

These are overkill and there is a really simple solution. Just add this following line of code to the PHP file that the jQuery AJAX is trying to communicate to:
header(‘Access-Control-Allow-Origin: *’);

This simple line of code tells the server that it will allow…

View original post 32 more words

Advertisements