jquery load encounters loop problem

WBOY
Release: 2016-10-11 14:23:23
Original
992 people have browsed it

Because of some requirements
I need to put the following jquery into the loop

<code>$(document).ready(function(){ 
        get_total<? echo $rs['buy_id'];?>();
    });
    function get_total<? echo $rs['buy_id'];?>(){
        $("#data_total<? echo $rs['buy_id'];?>").load("get_total?id=<? echo $rs['buy_id'];?>");
    }
    </code>
Copy after login
Copy after login

Because in order to get $rs['buy_id']
I would like to ask how to get each $rs['buy_id'] without putting it in a while?

Reply content:

Because of some requirements
I need to put the following jquery into the loop

<code>$(document).ready(function(){ 
        get_total<? echo $rs['buy_id'];?>();
    });
    function get_total<? echo $rs['buy_id'];?>(){
        $("#data_total<? echo $rs['buy_id'];?>").load("get_total?id=<? echo $rs['buy_id'];?>");
    }
    </code>
Copy after login
Copy after login

Because in order to get $rs['buy_id']
I would like to ask how to get each $rs['buy_id'] without putting it in a while?

<code>//对这些元素都加一个class 属性 class="get_total"

$(function(){
 $(".get_total").each(function(i){
        var thatId= i.attr('id');
        i.load('get_total?id='+thatId);
    });
});</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!