// GET JSON BLOCK
$.getJSON('http://localhost/api/members', function(result){
});
// GET JSON BLOCK
// AJAX BLOCK
$("#the_id_of_the_form").submit(function(e){
var form_data = new FormData($(this)[0]);
$.ajax({
url: 'http://localhost/admin/ajax.php',
type: 'POST',
data: form_data,
success: function (result, textStatus, xhr) {
if(xhr.status == 200){
// do something
}else{
alert('Enzo is awesome. But your code is hmm... How should I put it?');
},
error: function(e){
console.log(e);
},
cache: false,
contentType: false,
processData: false
});
e.preventDefault();
});
// AJAX BLOCK