3gwebtrain
3gwebtrain

Reputation: 15293

jquery - how to make dynamic content to recognize load function?

any one clear me with some good advice?, i have a page, and i am generating and appending some stuff in to the elements. later in new page i am loading the element using jquery load function, when i do the load function, i am only getting the static part, without any dynamic elements or data's what i created. what would be the reason?

i understand the dynamic content is not in the dom tree, if so how can i re-draw my dom tree to load any content made by dynamic to recognize the load function?

if this is not at all possible then any one give me the valid reason or advice?

Upvotes: 2

Views: 82

Answers (1)

David Hedlund
David Hedlund

Reputation: 129792

As with any AJAX request, .load will only make a request to a server, and will only retrieve what the server sends to it. The target server sends the same response regardless of whether it is a user browsing to the page, or an AJAX or other HTTP request fetching information on what's on the page: it simply sends back the content as instructed – in your case a HTML document with some JavaScript in it with instructions for how to create new elements.

If a user browses to the page, the browser will execute this JavaScript code, which in turn will cause these elements to be created. If you request the page with .load, you will get the exact same info, and place it in a container. If you want the JavaScript to be executed as well, you'll have to execute it manually.

Upvotes: 1

Related Questions