小编Вик*_*ков的帖子

查询。表中每一行的 Ajax 请求

我尝试对表中的每一行执行 Ajax 请求,但无法达到预期的结果

桌子:

<table>
        <tr class="data">
            <td class="editable">
                <a class="refresh btn btn-large" class="page">
                    Col one
                </a>
            </td>
            <td class="editable">
                <a href="#" data-pk="10" id="query" class="query">
                    Col two
                </a>
            </td>
        </tr>
        <tr class="data">
            <td class="editable">
                <a class="refresh btn btn-large" class="page">
                    Col one 1
                </a>
            </td>
            <td class="editable">
                <a href="#" data-pk="10" id="query" class="query">
                    Col two 1
                </a>
            </td>
        </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

Ajax 请求

$("#detect_rel").click(function(){
    $('.data').each(function(i, el) {
         var query   = $(el).children('.editable').children('.query').text();
        var page    = $(el).children('.editable').children('.page').text();

        $.ajax({
            url: 'wordstat/ajax?query='+query+'&page='+page,
            success: function(data){
                $(el).children('.editable').children('.relevantnost').html(data)
            }
        }); …
Run Code Online (Sandbox Code Playgroud)

ajax jquery

3
推荐指数
1
解决办法
4498
查看次数

查询。为表中的每一行发送ajax查询

我找到了很多关于我的问题的答案,但问题没有解决

我有表格,有数据,例如:

<table>
    <tr>
        <td class="editable"> <a id="query" href="#"> Data 1 </a> </td>
        <td class="editable"> <a id="text"  href="#"> Data 2 </a> </td>
        <td class="editable"> <a id="foo"   href="#"> Data 3 </a> </td>
        <td class="editable"> <a id="bar"   href="#"> Data 4 </a> </td>
    </tr>
    <tr>
        <td class="editable"> <a id="query" href="#"> Data 1 </a> </td>
        <td class="editable"> <a id="text"  href="#"> Data 2 </a> </td>
        <td class="editable"> <a id="foo"   href="#"> Data 3 </a> </td>
        <td class="editable"> <a id="bar"   href="#"> Data 4 </a> </td>
    </tr>
</table> …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery

2
推荐指数
1
解决办法
6766
查看次数

标签 统计

ajax ×2

jquery ×2

javascript ×1