Accessing a variable passed by jquery using php

Posted by celenius on Stack Overflow See other posts from Stack Overflow or by celenius
Published on 2011-01-14T23:44:40Z Indexed on 2011/01/14 23:53 UTC
Read the original article Hit count: 174

Filed under:
|

How does php access a variable passed by JQuery?

I have the following code:

$.post("getLatLong.php", { latitude: 500000},
   function(data){
     alert("Data Loaded: " + data);
   });

but I don't understand how to access this value using php.

I've tried

$userLat=$_GET["latitude"]; 

and

$userLat=$_GET[latitude];

and then I try to print out the value (to check that it worked) using:

echo $userLat; but it does not return anything. I can't figure out how to access what is being passed to it.

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery