dongsou0083
dongsou0083
2013-11-14 18:28

你能告诉我为什么这个ajax电话没有到达网络服务吗?

We are trying to user ajax to make a call to a webservice - Authentication/Validate but so far, it can't find the webservice.

Each time you run the script, you get, "error", just error.

The webservice is on a different web server while the ajax script calling it is on another server.

However, they are both on port 80 and on same domain.

I have been struggling with this for 2 days.

Script is below.

Thanks alot in advance

<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$.ajax({
      url:"Authentication/Validate",
     data: { data: JSON.stringify({ LoginName: "jane.doe",Password: "jdoe" }) },
     success: function (data) {
             alert("found!");
             debugger;
             var token = JSON.parse(data);
     },
     error: function(a,b,c) {
       alert(b+"
"+c)
     },
     dataType:"json"
});
</script>
</head>
<body></body>
</html>



param=data: {"LoginName":"jane.doe","Password":"jdoe"}

Response body: SyntaxError: JSON.parse: Unexpected end of data
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

相关推荐