Client Side
Server Side
response from php file
1 2 3 4 5 6 7 8 9 10 11 12 13 | $.ajax({ url: '/path/to/server', type: 'POST', data: { first_name : firstName, last_name: lastName, address: address, city: city, country: country }, success: function(result) { var obj = jQuery.parseJSON(result); if(obj.result == 'OK') { alert(obj.message); } else { alert(obj.message); } } }); |
Server Side
response from php file
1 | echo json_encode(['result'=> 'OK', 'message' => 'This is message']); |
Comments