Is there a way for an AJAX call to return both HTML content and callback functions?

reformed

I need to update HTML div content and a JavaScript function to be called with specific parameters retrieved via AJAX after the AJAX request completes. Is this possible in one AJAX call?

HIRA THAKUR
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("myDiv").innerHTML=xmlhttp.responseText;

    callback();     //execute my callback function!!!
    }
  }

Your HTML will be inside the xmlhttp.responseText.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I replace the entire HTML of a page, or its body content, via an AJAX call's success callback?

From Dev

my json ajax call return me nothing in the callback, but the data in network

From Dev

Return html form field on AJAX call

From Dev

Rendering dynamic HTML(angularjs content) content after ajax call in AngularJS

From Dev

Rendering dynamic HTML(angularjs content) content after ajax call in AngularJS

From Dev

JavaScript - Return promise AND/OR call callback?

From Dev

Ajax call, function callback, javascript

From Dev

Ajax call not replacing the content

From Dev

jQuery:: AJAX is not return any callback

From Dev

jQuery:: AJAX is not return any callback

From Dev

i need to return an entire html page using an ajax call

From Dev

Jquery Ajax Call Return

From Dev

return ajax by call back?

From Dev

Call one of two async functions but not both

From Dev

Why does Python call both functions?

From Dev

Overloading functions both on parameter and return types

From Dev

HTML5 geolocation: How to get pass lat and long values to an AJAX call after a success or error callback

From Dev

Cannot call callback functions on setState in componentDidMount ?? - React

From Dev

Using the Request callback in NPM to call additional functions

From Dev

Call other functions from a callback function

From Dev

Cannot call callback functions on setState in componentDidMount ?? - React

From Dev

When/why to use "return" in callback functions

From Dev

Content negotiation to return HTML

From Dev

AJAX Change HTML Content

From Dev

Is Callback Functions in Node js execute in synchronous way?

From Dev

JQuery load functions on AJAX call

From Dev

How to call ajax functions in sequence?

From Dev

jQuery Ajax call caching content

From Dev

Is it possible to specify context in callback of a jsonp Ajax call?

Related Related

  1. 1

    How can I replace the entire HTML of a page, or its body content, via an AJAX call's success callback?

  2. 2

    my json ajax call return me nothing in the callback, but the data in network

  3. 3

    Return html form field on AJAX call

  4. 4

    Rendering dynamic HTML(angularjs content) content after ajax call in AngularJS

  5. 5

    Rendering dynamic HTML(angularjs content) content after ajax call in AngularJS

  6. 6

    JavaScript - Return promise AND/OR call callback?

  7. 7

    Ajax call, function callback, javascript

  8. 8

    Ajax call not replacing the content

  9. 9

    jQuery:: AJAX is not return any callback

  10. 10

    jQuery:: AJAX is not return any callback

  11. 11

    i need to return an entire html page using an ajax call

  12. 12

    Jquery Ajax Call Return

  13. 13

    return ajax by call back?

  14. 14

    Call one of two async functions but not both

  15. 15

    Why does Python call both functions?

  16. 16

    Overloading functions both on parameter and return types

  17. 17

    HTML5 geolocation: How to get pass lat and long values to an AJAX call after a success or error callback

  18. 18

    Cannot call callback functions on setState in componentDidMount ?? - React

  19. 19

    Using the Request callback in NPM to call additional functions

  20. 20

    Call other functions from a callback function

  21. 21

    Cannot call callback functions on setState in componentDidMount ?? - React

  22. 22

    When/why to use "return" in callback functions

  23. 23

    Content negotiation to return HTML

  24. 24

    AJAX Change HTML Content

  25. 25

    Is Callback Functions in Node js execute in synchronous way?

  26. 26

    JQuery load functions on AJAX call

  27. 27

    How to call ajax functions in sequence?

  28. 28

    jQuery Ajax call caching content

  29. 29

    Is it possible to specify context in callback of a jsonp Ajax call?

HotTag

Archive