Replace content in div after successful ajax function

前端 未结 2 464
一个人的身影
一个人的身影 2020-12-21 13:40

I would like to replace a content of

after the ajax function is successful, also without page refresh.

         


        
2条回答
  •  情深已故
    2020-12-21 14:32

    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' } );
    

提交回复
热议问题