On Oct 9, 2009, at 5:05 PM, LWD wrote:


Hi!
How can i pass a jquery variable to a php variable?
Or pass a jquery variable in GET or POST.
Thanks!!

Take a look at jQuery's Ajax methods -- for example, $.get() and $.post() -- and note the data argument:

http://docs.jquery.com/Ajax/jQuery.get#urldatacallbacktype
http://docs.jquery.com/Ajax/jQuery.post#urldatacallbacktype

"data: Key/value pairs that will be sent to the server."

So, using the example from the docs ...

$.get("test.php", { name: "John", time: "2pm" } );
... in test.php, $_GET['name'] will be "John" and $_GET['time'] will be "2pm"


--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to