你如果知道返回的是json,直接用 $.getJSON,给你个例子
$.getJSON(URL+"/getremotexml/?code="+code, function(message){
var msg=message.error;
if(msg!='no'){
$("#result").html(msg);
}else{
var items=message.item;
$.each(items, function(i, good){
var goods=good["@attributes"];
itemg= $.trim(goods.item_code);
}
})
$.post 是$.ajax({ type:"POST", 的简写形式,没啥差别,就是少些代码