2012-02-13 2 views
0
$.get registered callback function is not working. 

var timer = setInterval(function() 
{ 
    $.getJSON("/resposweb/resposmonitor", {updt:updateTime}, function(data) 
    { 
     $.each(data,function() 
     { 
      updateTime = this.time; 
      var bActName; 

      if(this.act == 'D') 
       $('#'+this.idNo).remove(); 
      else 
      { 
       if(this.act == null) 
        bActName = 'Ack'; 
       else if(this.act == 'A') 
        bActName = 'Ready'; 
       var $ctrl = $('<button/>').attr({ type: 'button', name:'btn'}).addClass("btn").text(bActName).button().click(function() 
        { 
         $but = $(this)$.get("/resposweb/resposmonitor",  
          { 
           action:'update',mod:$but.val(),idNo:$but.parent().parent().attr('id') 
          }, 
          function(data) 
          { 
           console.log('data'); 
           $('#cont2').append('ddefe'); 
          }); 
        }); 
       var $td1 = $('<span/>').text(this.kot); 
       var $td2 = $('<span/>').text(this.tableNo); 
       var $td3 = $('<span/>').attr('class','items').text(this.itemDesc); 
       var $td4 = $('<span/>').text(this.qty); 
       var $td6 = $('<span/>').append($ctrl); 
       var $td5 = $('<li/>').attr('class','ui-widget-content').attr('id',this.idNo).append($td1).append($td2).append($td3).append($td4).append($td6);$td5.appendTo($("#selectable2")); 
      } 
     }); 
    }); 
},5000); 

문제가 있습니까, 서버에서 요청을 받고 있는데 응답을 올바르게 보내고 있습니다. 이 기능이 실행되지 않는 이유. 나는 무엇이든을 놓쳤는가?jquery 버튼 클릭시 getJson 호출

응답 : 그것은 아마 구문 오류로 인한 것

+1

받는 응답에 대한 정보를 추가 할 수 있습니까? 귀하의 경우 '데이터' – Tx3

답변

0

성공. 브라우저의 JavaScript 콘솔/오류 로그를 확인하십시오.