![](/img/trans.png)
[英]AJAX post in using slim framework outputs 500 (Internal Server Error)
[英]AJAX POST to web api using Json - 500 internal server error
我正在尝试使用ajax jquery-POST方法从客户端连接到Web api。
我的代码示例:
<script type="text/javascript">
$(document).ready(function (){
$("#btn392").click(function () {
alert("test");
var url = "https://test.ie/V2/Core/Sessions";
var data = { AuthenticationProvider: 0 };
$.ajax({
type: "POST",
url: url,
data: JSON.stringify(data),
cache: false,
crossDomain: true,
dataType:'jsonp',
contentType: 'application/json; charset=utf-8',
headers: { 'Pz-ApplicationName': 'xxxx', 'Pz-ApplicationKey': yyyy','Access-Control-Allow-Origin':'*'},
success: function (msg) {
alert("Data Saved: " + msg);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(errorThrown);
},
});
});
});
</script>
得到如下响应:
要求网址:
https://test.ie/V2/Core/Sessions?callback=jQuery18301695447497748852_1466229802951&{%22AuthenticationProvider%22:0}&_=1466230308713
请求方法:GET
状态码:500内部服务器错误
远程地址:193.111.82.196:443
Response Headers
view source
Access-Control-Allow-Headers:Content-Type,Pz-Authorisation,X-Requested-With
Access-Control-Allow-Methods:POST,GET,PUT,DELETE,OPTIONS
Access-Control-Allow-Origin:*
Cache-Control:no-cache
Connection:close
Content-Length:409
Content-Type:application/json; charset=utf-8
Date:Sat, 18 Jun 2016 06:11:39 GMT
Expires:-1
Pragma:no-cache
Server:Microsoft-IIS/8.5
X-AspNet-Version:4.0.30319
X-Frame-Options:SAMEORIGIN
X-Powered-By:ASP.NET
Request Headers
view source
Accept:*/*
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
Connection:keep-alive
Host:pwpservice-qa.test.ie
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2770.0 Safari/537.36
Query String Parameters
view source
view URL encoded
callback:jQuery18301695447497748852_1466229802951
{"AuthenticationProvider":0}:
_:1466230308713
即使我尝试做一个帖子,它显示响应GET并引发内部服务器错误。 任何帮助是极大的赞赏。
就像消息说的那样,错误是在服务器处理您的请求时发生的。 服务器日志是检查以获取有关正在发生的情况的更多信息的最佳位置。 如果您无权访问它们,则可以打开浏览器的开发人员模式(所有人都拥有一个)以原始格式调试请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.