jquery load() strips script tags - workaround?

后端 未结 6 397
孤街浪徒
孤街浪徒 2020-11-29 12:18

Does anyone know of a work around for jquery .load() stripping out the script tags loaded from external content?

There\'s a lot of documentation of the fact that thi

6条回答
  •  旧巷少年郎
    2020-11-29 12:50

    Can you please confirm if it is stripping out the scripts or the event bind isn't working? However, I think you can change the approach a little bit. First modify your script like

    $("#titles_wrap").load("m_scripts/m_php/titles_loader.php", function(){
                                                                    $..some code
                                                                    $("[class^='title_send_']").click(function(){$("#title_php_loader").load("m_scripts/m_php/title_sender.php")});
                                                                    });
    

    Then remove the script part from php code

    while($result_array = mysql_fetch_array($result)) {
    
                if($i2<=($titles_total)){
    
                    $_SESSION['titles_string'] .= '
  • '.($i2+1).'
    current title:
    '.$result_array[1].'
    new title:
    GO
  • '; $i2++; } }

提交回复
热议问题