I would like to replace a content of <div id="container"></div> after the ajax function is successful, also without page refresh.
$.ajax({
type: "POST",
url: "scripts/process.php",
data: dataString,
success: function() {
//Whats the code here to replace content in #conatiner div to:
//<p> Your article was successfully added!</p>
}
});
return false;
http://api.jquery.com/html/
$.ajax({
type: "POST",
url: "scripts/process.php",
data: dataString,
success: function( returnedData ) {
$( '#container' ).html( returnedData );
}
});
also using http://api.jquery.com/load/,
$( '#container' ).load( 'scripts/process.php', { your: 'dataHereAsAnObjectWillMakeItUsePost' } );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With