, , AJAX, . , ajax . jQuery, - false
:
$(document).ready(function () {
$("input#submit").click(function(){
$.ajax({
type: "POST",
url: "test.php",
data: $('form.login_form').serialize(),
success: function(msg){
$("#form-content").modal('hide');
},
error: function(){
alert("failure");
}
});
return false;
});
});
jQuery return false
vanilla-JS:
eventObj.preventDefault();//do not handle event in a normal fashion
eventObj.stopPropagation();//do not propagate event to other handlers
, , (<form id='modalformid'>
) ( enter
), :
$('#modalformid').on('submit', function()
{
var frm = $(this);
$.ajax({
type: "POST",
url: "test.php",
data: frm.serialize(),
success: function(msg) {
$("#form-content").modal('hide');
},
error: function(){
alert("failure");
}
});
return false;
});
, , JS- (, jQuery), $(document).ready()
( console.log($)
console.log($ === jQuery)
)..
, $('form.login_form')
: ID . - . $('form.login_form')
. : CSS, JS (), /: .