2011-10-06 47 views
1

任何人都可以告訴我這是什麼,這是jQuery已添加到我的輸出結束「職位容器」,以及如何解決它?它不是來自json,所以問題是什麼。代碼在下面,輸出在最後加上。jQuery是否也會將代碼追加到ajax調用的結尾?

在此先感謝。

$(document).ready(function(){ 
     $('#waiting').show(500); 
     $('#message').hide(0); 

     $.ajax({ 
      type: 'get', 
      url: 'http://domain.com/api/index.php/id/18271', 
      dataType: 'json', 
      data: 'apiKeytest=1', 
      success: function(r){ 
       var output = ''; 
       for (a in r.DATA) { 
        for (b in r.DATA[a]) { 
         if (typeof(r.DATA[a][b]) == 'object') { 
          for (c in r.DATA[a][b]) { 
           output += c + ' = ' + r.DATA[a][b][c] + '<br />'; 
          } 
         } 
         else { 
          output += b + ' = ' + r.DATA[a][b] + '<br />'; 
         } 
        } 
       } 
       jQuery('#posts-container').append(output); 
      }, 
      error: function(XMLHttpRequest, textStatus, errorThrown){ 
       $('#waiting').hide(500); 
       $('#message').removeClass().addClass('error').text('There was an error.').show(500); 

      } 
     }); 

     return false; 
    }); 

輸出有這個末

argumentNames = function() { var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip"); return names.length == 1 && !names[0] ? [] : names; } 
bindAsEventListener = function() { var __method = this, args = $A(arguments), object = args.shift(); return function (event) {return __method.apply(object, [event || window.event].concat(args));}; } 
curry = function() { if (!arguments.length) { return this; } var __method = this, args = $A(arguments); return function() {return __method.apply(this, args.concat($A(arguments)));}; } 
delay = function() { var __method = this, args = $A(arguments), timeout = args.shift() * 1000; return window.setTimeout(function() {return __method.apply(__method, args);}, timeout); } etc............ 

的JSON

{ 
    "ERRORS": [], 
    "DATA": [ 
     { 
      "itemActive": true, 
      "itemTxt": "test", 
      "itemID": "30d2f2c1-58ca-4b3d-b3e0-d284ae5b25ab", 
      "itemValidTo": "October, 19 2011 00:00:00", 
      "itemName": "test", 
      "itemCreated": "October, 03 2011 00:00:00", 
      "image": { 
       "imageCreated": "October, 05 2011 00:00:00", 
       "imageURL": "test.jpg", 
       "imageID": "bc869a94-fee5-4fc8-bd21-e2de2f020310" 
      }, 
      "itembio": 53.0650849 
     } 
    ], 
    "MESSAGES": [ 
     { 
      "TOTAL": 1, 
      "CURRENTPAGE": 1, 
      "TOTALPAGES": 1 
     } 
    ] 
} 
+2

http://bonsaiden.github.com/JavaScript-Garden/#object.forinloop – thirtydot

回答