$("form#data").submit(function(){ var formData = new FormData($(this)[0]); $.ajax({ url: window.location.pathname, type: 'POST', data: formData, async: false, success: function (data) { alert(data) }, cache: false, contentType: false, processData: false }); return false; });
Short Version
$("form#data").submit(function() { var formData = new FormData($(this)[0]); $.post($(this).attr("action"), formData, function(data) { alert(data); }); return false; });
$.ajax({ url: 'php/upload.php', data: $('#file').attr('files'), cache: false, contentType: 'multipart/form-data', processData: false, type: 'POST', success: function(data){ alert(data); } });
To collect a group of elements, we pass the selector to the jQuery function using…
jQuery is a lightweight, "write less, do more", JavaScript library. The purpose of jQuery is…
HTML:- [crayon-68bdf23c6d7bb452671898/] CSS:- [crayon-68bdf23c6d7c1388798874/] JavaScript:- [crayon-68bdf23c6d7c3234232518/]
Prevent users typing special characters in text box, textarea, etc. [crayon-68bdf23c6d91e920174686/] ^[a-zA-Z]+$ Alphabets ^[a-zA-Z\s]+$ Alphabets…
Any interactive web site has form input - a place where the users input different…
[crayon-68bdf23c6dcf5877704883/]