Using Ajax to send form data

I have a HTML/PHP form using using post to send form data to a script php file. I want to send the data with out the page reloading upon clicking the submit button.

I am wondering how do implement AJAX to allow this functionality.

I have a good grasp of Javascript but have never used ajax technology.

If this question is beyond the scope of this Q&A if anyone could please point me in the right direction to a good tutorial That will allow me to implement this technology with out having to spend a couple of days learning how it all works. I am working with a very short deadline.

Cheers.

Answers


you can serialize and then post form data with jquery and optionally handle the response.

the following is an example from jquery's documentation http://api.jquery.com/jQuery.post/:

$.post("test.php", $("#testform").serialize());

If this is your first AJAX experience, I recommend a good toolkit like jQuery.

See: http://api.jquery.com/jQuery.ajax/


You could use this jQuery plugin: http://www.matiasmancini.com.ar/jquery-plugin-ajax-form-validation-html5.html

It also has form validation and works on IE6.


basically, you can do no wrong by using jquery javascript library with all the cool nifty functions ready, including ajax function which allows you to do ajax call with something as simple as $.post().

but if you're looking for a step by step tutorial, then you might want to look at this.


Need Your Help

double click event for div

javascript html

I am trying to add an event handler to a div that has an image inside of the div. My problem is that the event only works if you double click outside the div right next to it. When you double click...

How to restore non-renewing Apple subscriptions

ios storekit in-app

The app I'm working on was recently rejected by Apple for containing an auto-renewable subscription. They recommended that we switch to non-renewing subscriptions for our content.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.