jquery html() strips out script tags

前端 未结 5 973
再見小時候
再見小時候 2020-11-28 14:17

I need to replace the content of a div in my page with the html resultant from an ajax call. The problem is that the html have some necessary scripts in it and it seems that

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 14:42

    I had the same problem, but with more issues which I couldn't fix that easily. But I found a solution:

    This is my pseudo-source (HTML) that I couldn't change in any way.

    
      
        

    I used $.get() to fetch this HTML page. Now that I have the code as a string, it's time to search in it with jQuery. My aim was, to isolate the Javascript-Code inside the

提交回复
热议问题