简体   繁体   中英

doing an each function with ajax to return multiple data?

I have a php function that does a loop, and the loop pretty much shoots out a list of names, and then if you click on the name, I've developed some slide down content to show information on that name. And I have some pagination set up where its supposed to go inside that container.

But, its not working, and I'm thinking that its because its not going to know to load into all the names.

function loadData(page){
                //loading_show(); 
                dataString = "page="+page+"&name_list="+name_list;          
                $.ajax
                ({
                    type: "GET",
                    url: "ajax_name.php",
                    data: dataString,
                    success: function(msg)
                    {
                            $("div.names").html(msg);

                    }
                });
     }
loadData(1);  // For first time page load default results

so pretty much loadData is supposed to load into multiple name containers. So the PHP is theres a while loop creating multiple names with multiple containers for the data thats supposed to be loaded.

Any idea as to how to get this loadData to load within each div? Do I have to do an each? but i'm not quite sure how to incorporate it in this function.

Thanks

我将使用内置的json_encode()方法对需要从服务器返回的所有数据进行json编码,然后遍历所有返回的数据。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM