I want to pass json object to a [WebMethod].
My [WebMethod] looks like this;
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void UpdateBooksOrder(Success succ)
{
try
{
if (succ != null)
{
updateDal.LogSGDetails(succ);
}
}
catch (Exception ex)
{
logger.Error("exception ", ex);
}
}
And, I get [WebMethod] URL as;
http://localhost:50596/OrderStatusUpdate.asmx?op=UpdateBooksOrder
For testing, I am passing a json object to above [WebMethod] using html+ajax like this;
<script type="text/javascript">
$("#btnUpdate").live("click", function () {
//alert("OK");
var succ = {};
succ.id = "1";
succ.refrerence = "148997";
succ.external_ref = "GF0000148997";
succ.status = "1";
succ.status_name = "test";
$.ajax({
type: 'POST',
url: 'http://localhost:50596/OrderStatusUpdate.asmx?op=UpdateBooksOrder',
data: "{succ:" + JSON.stringify(succ) + "}",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function () {
alert("OK");
}
});
});
</script>
When I run the WebService project and call it via html I get following error;
Status Code:405 Method Not Allowed
Please guide me a way to resolve that.