日期:2014-05-16  浏览次数:20429 次

php jquery json问题
我php返回的是很多条数据,转换成的json
jquery ajax请求
$.ajax({
                'type': 'GET',
                'url':"<?php echo $this->createurl('checkone')?>",
                'cache': false,
                'dataType' :"html",
                'data':{"user_id":user_id,"com_id":com_id,"dep_id":dep_id,"pay_card_id":pay_card_id,"taozhang_id":taozhang_id,"stime":stime,"etime":etime},
                'success': function(data) {
                    list=JSON.parse(data);
                    $.each(list,function(key,val){
                        alert('aaa');
                    }

                }
            });
我打印出来获取的 data数据是
{
"taoz":
[
{"taoz_option_id":"3","taoz_option_name":"\u6d4b\u8bd5","taoz_option_type":"1","taoz_option_initial_value":"230","taoz_option_status":"1","taoz_option_order":"12","taoz_option_formula":""},
{"taoz_option_id":"7","taoz_option_name":"test2","taoz_option_type":"2","taoz_option_initial_value":"935","taoz_option_status":"1","taoz_option_order":"45","taoz_option_formula":"2,3,-4"},
{"taoz_option_id":"2","taoz_option_name":"\u57fa\u672c\u5de5\u8d44\u554a","taoz_option_type":"1","taoz_option_initial_value":"1305","taoz_option_status":"1","taoz_option_order":"254","taoz_option_formula":""}
],
"real_name":"\u6d4b\u8bd5"
}
然后 list=JSON.parse(data);
可是后面试着循环数据怎么也得不到值,请问是什么原因

------解决方案--------------------
'success': function(data) {
 alert(data);//看下返回对不对
  eval("list="+data);
                    //list=JSON.parse(data);
                    $.each(list,function(key,val){
                        alert('aaa');
                    }

                }