1var datastring = $("#contactForm").serialize();
2$.ajax({
3 type: "POST",
4 url: "your url.php",
5 data: datastring,
6 dataType: "json",
7 success: function(data) {
8 //var obj = jQuery.parseJSON(data); if the dataType is not specified as json uncomment this
9 // do what ever you want with the server response
10 },
11 error: function() {
12 alert('error handling here');
13 }
14});
1var form = document.querySelector('form');
2var data = new FormData(form);
3