English 中文(简体)
Ajax, Jquery, 用$.ajax的通话程序
原标题:Ajax , Jquery, calling procedure with $.ajax
  • 时间:2012-05-22 13:37:49
  •  标签:
  • jquery
  • ajax

I have a click event on Jquery, I am getting arrays with help of $.ajax and post, after that I am calling another procedure in a loop . Second procedure has a $.ajax too , is it allowed ? My script seems not working, I dont know what would wrong ? Just give me any hint or clue please And feel free to ask any questions

代码 :

$("#list").click(function(){                  
   var ptext ="";
   $.ajax({
   type: "POST",
   url: "phpname.php",
   data: ({
   newtask: "grab"
    时 时),
   dataType: "json",
   success: function(data){
   $.each(data, function(key, value) {
   ptext=value.name;    
   parseclick(ptext);   
   时 时);
   时 时    
   时 时);  
 时 时);    
  时 时);

function parseclick(ptext)
 {
    $.ajax({
   type: "POST",
   url: "phpname.php",
   data: ({
          grab_ads : "grab",
          list_url : ptext

          时 时),
   dataType: "html",
   success: function(msg){

     $("#all_name").append(msg);
     var part= msg.split("#url#");  
     $("#current_num").val(part[0]);
       时 时    
         时 时);        
                                  时 时);

时 时

最佳回答

是的,它是允许的。但是如果你在第二个预言中做一个 Ajax 呼叫, 没有设定非同步的错误选项, 循环将同时生成一堆 Ajax 呼叫, 而不等待服务器回应 。

编辑: 在您添加一个示例后, 我可以看到太多的封闭括号 。

问题回答

暂无回答




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签