Codeigniter在ajax调用后再次运行jquery函数

时间:2016-05-25 10:37:59

标签: javascript ajax codeigniter

如何在codeigniter中调用Ajax之后应用jquery

我的ajax调用代码

    function load_data_ajax(type){
    $.ajax({
        'url' : '/index.php?compose/get_list',
        'type' : 'POST', //the way you want to send data to your URL
        'data' : {'type' : type.value},
        'success' : function(data){ //probably this request will return anything, it'll be put in var "data"
            var container = $('#container'); //jquery selector (get element by id)
            if(data){
                $('#container').html(data);
            }
        }
    });
}

我的Html

        <table align="center">
    <tr>
    <td>
        <font class="formpromp">Select Category: </font>
            <SELECT name="crs" onchange='load_data_ajax(this)'>
            <?php
                foreach($query as $rowcrs):
                    echo "<OPTION value='".$rowcrs['CD']."'>".$rowcrs['TITLE1']."</OPTION>\n";
                endforeach;
            ?>
            </SELECT>
    </td>   
    </tr>
    </table>
    <div id="container">
        <table id='table1' border='1' cellspacing='0' cellpadding='0'><thead><tr>
        <th align='left'><input type='checkbox' value='' />Code</th>
        <th>Name</th>
        </tr>
        </thead>
        <tbody>
            <tr>
                <td>1</td>
                <td>huzefa</td>
            </tr>
            <tr>
                <td>2</td>
                <td>husain</td>
            </tr>
       </tbody>
       </table>
    </div>

我正在使用Table filtergrid表

    <script type="text/javascript" language="javascript" id="t3">
        var tf = setFilterGrid('table1', props);
    </script> 

ITS正确加载第一次,但我无法理解如何加载Ajax数据后加载java脚本。

请任何人帮助我。

由于

0 个答案:

没有答案
相关问题