消息关闭
    暂无新消息!
我使用jquery的ajax返回页面后,使用html()加载页面,但页面上的js代码不执行,试过了好多中方法都不行,无法alert
<script type="text/javascript">
    $(document).ready(function() {
        alert("success");

    })


</script>
<div class="panel panel-default" >
    <input type="button" id="test" >
    <div class="panel-heading">
        <div class="panel-btns">
            <a href="" class="panel-close">&times;</a>
            <a href="" class="minimize">&minus;</a>
        </div>
        <h3 class="panel-title">大数据中心成员列表</h3>
    </div>
    <div class="panel-body">
        <div class="table-responsive">
            <table class="table" id="userTable">
                <thead>
                <tr>
                    <th><input type="checkbox" name="select_all" value="1" id="example-select-all" style="width: 20px;height: 20px;"/></th>
                    <th>邮箱</th>
                    <th>姓名</th>
                    <th>职务</th>
                    <th>部门</th>
                    <th>科室</th>
                    <th>状态</th>
                </tr>
                </thead>

            </table>
        </div>
    </div>
</div>

4个回答

︿ 0
为了安全起见,html是无法执行js的。你需要使用load方法
参见
http://www.cnblogs.com/techmango/archive/2011/05/19/Jquery_load_method_and_html_method.html