Jquery Form Plugin
Written by Zaizarul Shawari Zainalabidin
Overview
The jQuery Form Plugin allows you to easily and unobtrusively upgrade HTML forms to use AJAX. The main methods, ajaxForm and ajaxSubmit, gather information from the form element to determine how to manage the submit process. Both of these methods support numerous options which allows you to have full control over how the data is submitted. Submitting a form with AJAX doesn't get any easier than this!
PENERANGAN
Plugin jQuery form memudahkan penggunaan class $.ajax jQuery. Pengguna plugin ini tidak perlu menulis script dengan panjang, dengan hanya memberi kan id pada form ianya terus boleh dijadikan AJAX.
Contoh :
<html>
<head>
<script src="/http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="/http://malsup.github.com/jquery.form.js"></script>
<script>
// wait for the DOM to be loaded
$(document).ready(function() {
// bind 'myForm' and provide a simple callback function
$('#myForm').ajaxForm(function() {
alert("Thank you for your comment!");
});
});
</script>
</head>
<form id="myForm" action="comment.php" method="post">
Name: <input type="text" name="name" />
Comment: <textarea name="comment"></textarea>
<input type="submit" value="Submit Comment" />
</form>
NOTA : Plugin ini juga membenarkan upload file tanpa perlu reload page
Sila KLIK untuk keterangan lanjut
