Here’s an example taken from
http://docs.jquery.com/API/1.1/AJAX#.24.post.28_url.2C_params.2C_callback_.29
$.ajax({
type: "POST",
url: "some.php",
data: "name=John&location=Boston",
success: function(msg){
alert( "Data Saved: " + msg );
}
});
So does
data: "name=John&location=Boston"
assign the value ‘John’ to the variable $name and ‘Boston’ to $location in some.php ?
Or what does it do…?
On the website they simply say
“Save some data to the server and notify the user once it’s complete.“
It makes the browser request the URL
with the message body:
These will appear as
$_POST['name']and$_POST['location'].Don’t build your data strings by hand though. If you are using jQuery anyway, let it build them for you. It will handle escaping for you automatically.