數據我有一個代碼,請求REST Web服務:如何從Ajax響應
<script>
var respone='';
$('.inn').on('change',function(){
$.ajax({
type: "post",
dataType: "jsonp",
url:url,
success: function(data){
var json=JSON.parse(data);
respone=data;
console.log(respone);
},
error:function(e)
{
console.log(e);
}
});
alert(respone);
console.log(respone)
})
</script>
REST Web服務工作正常,返回JSON數據。 Ajax也返回一些數據,但不在控制檯中。是否有可能獲得ajax響應並在控制檯中預覽它?
是吧'jsonp'或'JSON'? –
對於jsonp你需要回調 – guradio
請在'var json = JSON.parse(data);'in'success'回調之前放置'console.log(data)',並在這裏發佈結果。 – 31piy