1.把数组str转换成json格式
str = '{';
for( x in arr){
str += '"'+x+'"'+':"'+arr[x]+'",';
}
str += "}";
2.
ajax:
jQuery.ajax({
async:false,
timeout: 80000,
dataType: 'json',
type:'get',
data: {
str:str,
name_id:name_id,
},
url:ajaxurl,
success:function(data, textStatus){
if(data.status == 'success'){
//alert(data.status);
jQuery(".lll").html(data.html);
}
},
error:function (XMLHttpRequest, textStatus, errorThrown){
jQuery(".waiting").hide();
}
});
3
php部分:
$str1 = trim(Mage::app()->getRequest()->getParam('str'));
$str1 = str_replace(",}","}",$str1);
$str = json_decode($str1);