从文件html加载脚本标签 [英] Load script tag from the file html

查看:73
本文介绍了从文件html加载脚本标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在第一页的标题中

<script type="text/javascript">
$(document).ready(function(){
  $("#register_reg").click(function(){
    $("#register_form").load("test_test.php #register_rules");
  });
});
</script>

在第二个文件(test_test)中ID #register_rules 的内容.php)
有这一行

In the content of the ID #register_rules in the second file (test_test.php) there are this line

<script type="text/javascript" src="jquerycode.js"></script>

问题是,在第一页中,
,当我点击链接(ID# register_reg)行脚本未添加到ID #register_form

The probleme is, in the fist page, when i click the link (ID #register_reg) the line script not added in the ID #register_form

那么,如何添加内容ID #register_rules在ID #register_form中带有here脚本

So, how I can add the content of the ID #register_rules with here script in the ID #register_form

推荐答案

这是正确的代码

<script type="text/javascript">
$(document).ready(function(){
  $("#register_reg").click(function(){
    $("#register_form").load("test_test.php #register_rules", function() { 
        $("#register_form").append("<script type='text/javascript' src='jquerycode.js'></" + "script>"); 
    });
  });
});
</script>

这篇关于从文件html加载脚本标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆