I am calling an ajax script to fetch a content of a page and then replace the current contents with the fetched one. One problem I am facing is that there is a j开发者_StackOverflowavascript on the fetched page which doesnt get rendered and is treated as text. How do I make sure that the javascript gets loaded?
write javascript(fetched page) code in main page.
for example:
$.ajax({
url: "your fetched page url",
dataType: "html",
type: 'POST',
data: "your data",
success: function(data){
$("#result").html(data); //call back div
//put your javascript code from fetched page here
}
});
精彩评论