$("form").submit(function(event) {
event.preventDefault();
$data = $(this).serialize();
if(!$(this).attr("action")) { var $url = document.location.href; } else { var $url = $(this).attr("action"); }
if(!$(this).attr("method")) { var $method = "post"; } else { var $method = $(this).attr("method"); }
$.ajax({
url: $url,
type: $method,
data: $data,
dataType: "json",
success: function(data){
}
});
});