$.post( "test.php", { name: "John", time: "2pm" })
.done(function( data ) {
alert( "Data Loaded: " + data );
});
$.post("url/to/php_file.php", {query1:'value', query2:'value'}).done(function (data) {
// your code
console.log(data)
});
$.ajax({
method: "POST",
url: "some.php",
data: { name: "John", location: "Boston" }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
$(function(){
$('#myForm').on('submit', function(e){
e.preventDefault();
$.post('http://www.somewhere.com/path/to/post',
$('#myForm').serialize(),
function(data, status, xhr){
// do something here with response;
});
});
});
$.post("demo.php",{id:1})
.done(function(data) { console.log(data) })
.fail(function() { console.error("Error") })
$.post( "ajax/test.html", function( data ) {
$( ".result" ).html( data );
});
$.post( "test.php", { name: "John", time: "2pm" } );