success: function(myjson) {
                            alert('1');
                            var j = { one: 1, two: 2, three: 3, four: 4, five: 5 };
                            alert('2');
                            
                            alert('3');
//                            test.classifies.each(function(i, val) { alert(i + ":" + val); });
                            jQuery.each(myjson.classifies, function(i, val) {                                alert(i + ":" + val.name);
                            });
 var test = $(myjson);
 test.classifies.each(function(i, val) {
                alert(i + ":" + val);
               });
这个错误 jQuery.each(myjson.classifies, function(i, val) {
                alert(i + ":" + val.name);
                });
这个就正确 
为什么?

解决方案 »

  1.   

    jQuery.each 是应用到一个jQuery数组对象, 或者遍历数组来的
    所以觉得
    var test = $(myjson.classifies);
      test.each, 这样应该也是可以的
      

  2.   


    刚测试了一下 这样写可以
    var test = $(myjson);
    为什么test.classifies.each  这样写就不可以了呢?
      

  3.   

    myjson 不是 $(myjson)  
    $(myjson).classifies  这个不存在
     
      

  4.   

    看API, 呵呵,
    是只有JQuery对象数组才能这样用, JQuery对象数组.each()方法;
    你那个应该都不算什么东西, 呵呵,
    你直接 alert($(myjson).classifies);应该是没东西的咯