Form name
Username:
Password:
Option A:
Option B:
Option C:
Select Box:
1
2
3
$().ready(function() {
var $ajaxForm = $('#ajax-form');
// Create container to store ajax result
$ajaxForm.find('.buttons').after($('
// Bind event handler
$ajaxForm.bind('submit', function(event, data) {
// Simple ajax POST request
// See http://api.jquery.com/jQuery.post/
$.post($ajaxForm.attr('action'), 'ajax=1&' + $ajaxForm.serialize(), function(data) {
$('.result').html(data);
});
// Disable default form submit behavior
return false;
});
// Bind click handler to override "reset" behavior...
// Although this really isn't necessary if you're using the HTML
element, which you should be...$ajaxForm.find('button:reset').bind('click', function(event, data) {
var $els = $ajaxForm.find('input, textarea, select');
$els.filter('input:text, input:password, textarea').val('');
$els.filter('input:radio, input:checkbox').attr('checked', false);
$els.filter('select').attr('selectedIndex', '');
return false;
});
});
fieldset {
border: 0;
padding: 0;
margin: 0;
}
fieldset legend {
display: none;
}