Вы можете использовать метод .serialize()
для отправки содержимого формы с использованием AJAX на соответствующее действие, как если бы это был обычный запрос:
$('#getDealers').submit(function(e) {
$.ajax({
url: this.action,
type: this.method,
data: $(this).serialize(),
success: function(result) {
// TODO: do something with the result returned by the server
}
});
e.preventDefault();
});
И чтобы избежать записивесь этот код вы можете использовать отличный плагин jquery form :
$(function() {
// AJAXify the getDealers form
$('#getDealers').ajaxForm(function(result) {
// TODO: do something with the result returned by the server
});
});