0

这是我在 sencha 中用于接收 JSON 数据的代码,问题是当我调用时由于语法原因总是显示错误消息。我不知道它在哪里失败,因为我是 sencha 的新手,这是我的代码

   Ext.Ajax.request({
                     url: 'http://117.218.59.157:8080/WishList/Login',
                     method: 'POST',
                     headers: { 'Content-Type': 'application/json;' },
                     jsonData:{
                               username : "faz@gmail.com",
                               emailId : "faz"
                              },
                     success: function (response) 
                     {
                     alert(response.responseText);
                     },
                     failure: function (response) 
                     {
                     alert(response.responseText);
                     }
                  });

当上述方法调用它显示以下响应

  <html><head><title>Apache Tomcat/7.0.14 - Error report</title><style><!--H1 {font-
  family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
  H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-
  size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-
  color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-
  serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-
  serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-
  serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color :
  black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - </h1><HR   
  size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The requested resource () is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.14</h3></body></html>

我在提琴手中调用 JSON url,格式如下

  Method: POST
  URL:  http://117.218.59.157:8080/WishList/Login
  Request:
  {
  "emailID": "xy@gmail.com",
  "password": "ganesh"
  }
  Response:
  [
   {
    "response": "Success"
    }
   ]

我不知道我的代码在哪里失败。请帮我整理一下

4

2 回答 2

0

HTTP 状态 404表示“找不到资源”。117.218.59.157:8080 的服务器未配置为在路径上提供资源/WishList/Login。您必须查看服务器配置/代码才能找出原因。请注意,某些 HTTP 服务器区分大小写,因此(例如)可能与服务器不同WishListWishlist

于 2013-08-26T10:33:52.320 回答
0

我个人使用 google chrome 扩展程序来检查我通过 Ajax 调用的服务,以确保它们正常。这对我帮助很大,您只需将您的 URL 放在那里并模仿 GET/POST - https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

祝你好运!

于 2013-08-27T07:19:15.923 回答