开发者

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 functionalit开发者_如何学JAVAy.

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.


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

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


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());


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜