当我运行该方法时不包括parameters
,但一切正常,但是当该方法与parameters
一起运行时,我得到500 Internal Server Error
。我不确定我做错了什么,谢谢你的帮助。如何通过使用jQuery的ASP.NET WebService中的AJAX传递数据参数
无法加载资源:服务器500(内部服务器错误)的状态
包含如下回应是,我目前使用的代码:
[WebMethod]
public static string UploadNewImage(string filePath,string ImageTitle,string ImageDescription,string ImageKeywords)
{
}
var parameters = "{'filePath':'" + fileuploadpathValue.val() + "','ImageTitle':'" +
titleValue.val() + "','ImageDescription':'" + descriptionValue.val() + "','ImageKeywords:'" +
keywordsValue.val() + "'}";
$.ajax({
type: "POST",
url: "../MainService.asmx/UploadNewImage",
contentType: "application/json; charset=utf-8",
data: parameters,
dataType: "json",
success: AjaxSucceeded,
error: AjaxFailed
});
你有什么存储在pa rameters? – yoozer8
在这里找到了解决方案http://stackoverflow.com/questions/5558217/error-when-calling-a-json-webservice-from-jquery。感谢所有的帮助。 – user516883