开发者

Javascript function not loading with AJAX call

I have an html page tha开发者_开发知识库t makes an ajax call to a jsp page that has a javascript function. It looks like the JS function is not getting executed.

Sorry I tried to search for an answer but couldn't find any.

Thanks in advance.


If your data is javascript text then in response you must dynamicly create sctript tag and put text into it.

var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.innerHTML = yourResponseScript;
head.appendChild(script);


Even if the ajax request returned javascript, injecting that into existing html won't execute the javascript.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜