Asked 2 years ago
24 Jun 2021
Views 599
Jackie

Jackie posted

Run jquery function again after ajax call

Run jquery function again after ajax call
duglus

duglus
answered Aug 26 '21 00:00


.load() function is used to load ajax content to the id or class.
and you can run jquery code after the Ajax done, but function as the second argument in load function.


$( "#id or class" ).load( "test.php", function() {
  $("id or class").html('do something for other id or class')
});
pratik

pratik
answered Aug 26 '21 00:00

if you using POST jquery ajax call then put it in the second argument in the post() method and put the code of Jquery you want to run after ajax completion in there.
example of running jquery function again after ajax call :


$.post( "put url here ", function( data ) {
// put here jquery code 
});
pratik

pratik
answered Aug 26 '21 00:00

if you using POST jquery ajax call then invoke done() method on the $.post() and put the code of Jquery you want to run after ajax completion in done() method .
example of running jquery function again after ajax call :


 
$.post( "put url here")
  .done(function( data ) {
 // put here jquery code 

  });
Post Answer