问题
I have read similar posts and Modified according to them ..still not able to fix this error on My Page .. On Debug ..In FireBug there is no other error shown in Console ..Just this Error
500 Internal Server Error
....parameters Name in method is also same
this is my ajax method :
function getErrorStatusList() {
var serve = new Object();
serve.issueID = $("#proselct option:selected").val();
$.ajax({
type: "POST",
url: "UFZillaErrorStatus.aspx/GetErrorStatusList",
data: JSON.stringify(serve),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
},
error: function () { alert("Server Error!!");}
});
this is WebMethod
public partial class UFZillaErrorStatus : System.Web.UI.Page
{
[WebMethod]
public static UFZillaErrorStatusList GetErrorStatusList(int issueID)
{
return Dashboard.Model.UFZillaErrorStatus.UFZillaErrorStatusService.Get(issueID);
}
}
what Else could be done to track this issue ..Any Suggestion would be Helpful
回答1:
Can you please try as below:
function getErrorStatusList() {
var serve=JSON.stringify({issueID:$("#proselct option:selected").val()});
$.ajax({
type: "POST",
url: "UFZillaErrorStatus.aspx/GetErrorStatusList",
data: serve,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
},
error: function () { alert("Server Error!!");}
});
回答2:
I think the problem is with parameter in the service. Your service is written to serve GET method, but you are trying with POST method, sending data in body.
Send data as url parameter as below:
Try the following:
function getErrorStatusList() {
$.ajax({
type: "GET",
url: "UFZillaErrorStatus.aspx/GetErrorStatusList/?issueID="+$("#proselct option:selected").val(),
dataType: "json",
success: function (response) {
},
error: function () { alert("Server Error!!");}
});
}
Tell me what output you are getting when you tried this.
来源:https://stackoverflow.com/questions/24241010/ajax-call-results-in-500-internal-server-error