$.post("", {message: msg}, function() {
views:
73answers:
1
+3
A:
That's the jQuery post method making a POST request to the current page (I'm guessing here, I'm assuming it just posts to the current page if that parameter is an empty string) with the contents of variable msg
being passed as a parameter named message
John Sheehan
2009-06-17 02:58:38
Just wondering... What if I need to pass more than one parameter?
Delirium tremens
2009-06-17 03:00:18
The second parameter is a JSON object, so you could pass any valid JSON object: {message: msg, id: 1, active: true}
John Sheehan
2009-06-17 03:01:47
you would need to know the parameter names and pass it... example {message: msg, secondParam: parm2, thirdParam: param3}
Roy Rico
2009-06-17 03:03:14
@John: it's not JSON, it's a JS object, which is encoded into the request content using either urlencode, or mime-multipart. no JSON involved.
Javier
2009-06-17 04:32:22
You are correct, I misspoke in my haste. Thanks for pointing that out.
John Sheehan
2009-06-17 05:11:45