Page 1 of 1

JQuery Forms Ajax

Posted: Sun Nov 25, 2007 2:15 pm
by wildwobby
Hey,

Im trying to learn jQuery and wanted to figure out the ajax part of it.

I have a form and wanted it to load html into another div based on whats in the form. I can't figure out what the jQuery code is to to POST the values of each form to the php file...

Posted: Sun Nov 25, 2007 5:16 pm
by s.dot

Code: Select all

$.post( url, data, callback);
You can also use $.ajax(), depending on your needs.

http://docs.jquery.com/Ajax/jQuery.post

Posted: Sun Nov 25, 2007 6:54 pm
by wildwobby
but how do you get to actually send the data in the form...

Posted: Mon Nov 26, 2007 11:53 am
by Kieran Huggins
the "data" part is an object, you can build it on the fly like this:

Code: Select all

{name: $('#name').val(), title: $('#title').val()}
...etc...