When loading an html page via ajax, will script tags be loaded?

后端 未结 5 1991
南笙
南笙 2020-11-27 14:23

When you load an html document using AJAX, what does it do with the nodes inside the HEAD tag: (script,link,style,meta,title) ignore them or load and parse them? And in the

5条回答
  •  孤独总比滥情好
    2020-11-27 15:26

    As has been pointed out, in general - no, script tags will not be interpreted.

    I'm not at all sure what will happen with the other tags.

    I'm making an assumption here that you are loading an entire page in AJAX - I'm not sure why you would want to do that? Maybe you could give us a bit more information and we could make some suggestions?

    To address your question more directly - in general, any scripts required on the reloaded content should not be reloaded with the content but with the page. That way you can arrange to have a callback from your AJAX reattaches event handlers etc.

提交回复
热议问题