2016-08-24 29 views
0

这里是我的Ajax调用请求数据,以Ajax调用转换为JS对象

$.ajax({ 
    url:'http://localhost:8081/organizations/', 
    data: JSON.stringify({"name":"karthik"}), 
    type: 'POST', 
    dataType :'json', 
    processData : true, 

    success: (function(response){ alert("response "+response);}), 
    error: (function(err){ console.log(err); }) 
}); 

在API中,当我试图打印request.data,为什么我收到这样{u'{"name":"karthik"}': [u'']}

+0

阅读此问题应该可以帮到你。 http://stackoverflow.com/questions/17785592/difference-between-json-stringify-and-json-parse –

回答

0

更换下面线

success: (function(response){ alert("response "+response);}), 

通过newone

success: (function(response){ alert(JSON.stringify(response));}), 

在你的代码,然后尝试它会工作。