jquery post without page reload in jquery-3.2.1
there is a working solution for jquery 1.9.1 with $.ajax
/* jquery-1.9.1 */
$(function () {
$('form').bind('submit', function () {
$.ajax({
type: 'post',
url: 'worker.php',
data: $('form').serialize(),
success: function () {
alert('form was submitted');
$( "#result" ).html(result);
}
});
return false;
});
});
i tried the code above with the newest version $.ajax is not found anymore
"TypeError: $.ajax is not a function"
i tryed the folowing (but there is still a page reloading)
/* jquery-3.2.1 */
$( "#form" ).submit(function( event ) {
$.post( "worker.php", $( "form" ).serialize() )
.done(function(result) {
$( "#result" ).html(result);
return false;
});
});