$ .post始终返回undefine

JMa*_*Man 2 ajax jquery callback

当我进行以下jQuery调用时

$.post('/publish/comments', 
  parms,
  function(data, textStatus){
    console.log('textStatus: ' . textStatus);
    console.log('returned data: ' . data);
    console.log('nextPage: ' . data.nextPage);
  },
  "json"
); 
Run Code Online (Sandbox Code Playgroud)

控制台显示数据,textStatus和data.nextPage都是未定义的.

但是在Chrome开发工具(网络标签)中,我可以看到以下JSON数据正从服务器传回.

{success:true, nextPage: /go/page/requestId/182/src/publish}
nextPage: "/go/page/requestId/182/src/send"
success: true
Run Code Online (Sandbox Code Playgroud)

思考?

Dou*_*eux 7

菲利克斯指出,联合会需要"+"

另外,我发现如果要记录整个对象,则不希望在console.log()中包含字符串.

尝试console.log(data)而不是在它之前放置字符串(如"data:"),这将保证在控制台中可以看到整个对象.