I am using jQuery and Ajax.
My MainFile has the following code:
<html> <head> <script src='Myscript.js'> </script> <script type='text/javascript'> $(document).ready(function(){ $.ajax({ type: 'POST', url: 'ajax.php', success: function(data){ $('#response').html(data); } }); }); </script> <body> <div id='response'> </div> </body> </html>
My ajax.php get the sample data
... MyScript.js has the following function display (text,corner) { } ..
I have Myscript.js. In this, I have a function called display(text,corner). I have to call this function after executing ajax.php.
How do I do it in jQuery for the above code?
Is it possible to decide the order of execution after ajax.php and make call for display(text,corner)?
You should invoke the
displayfunction in the callback function of the Ajax Request, like such:In the above case,
datais the response that is received fromajax.php