I'm trying to update a mySQL database using variables from Server A and PHP at Server B. I have access to both servers.
Here's my jQuery on server A.
$.post( "http://xxx/xxx/xxx/update.php", { vote:currentVote, page:pageURL, round:roundNumber });
When I inspect it in Firebug, the console shows the POST with a 200 OK and when I click on the console the Parameters show up correctly.
I've updated my crossdomain.xml.
Here's my php code on server B. When I run the php file alone with manual variables, everything works as expected and the variables are inserted into the database just fine. When I comment them out like I did below, and rely on the $_POST, nothing happens.
//1. Get variables we need from those posted.
$page = $_POST['page'];
$round = $_POST['round'];
$vote = $_POST['vote'];
//$page = "r1m11";
//$round = "1";
//$vote = "Test Restaurant";
A few questions:
- Are there any glaring errors in the code that might prevent this from working?
- For troubleshooting, is there an easy way to test that the crossdomain policy is working?
Thanks!
Edit: I didn't know what CORS was but the answer was on that page marked as a duplicative post. I just needed to add...
header("Access-Control-Allow-Origin: http://www.website.com");