I am trying to call a method as web method from ajax like:
$.ajax({
url: 'http://ift.tt/1SI1MDN',
method: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
//data: angular.toJson(categories),
data: angular.copy(categories)
Here categories is serialized as
[
{
"name": "Fruits",
"metrics": "cups",
"entry": 0,
"recommended": true,
"color": "#989898"
},
{
"name": "Vegetables",
"metrics": "cups",
"entry": 1,
"recommended": true,
"color": "#37A0BC"
}
]
Webmethod is like:
[WebMethod(true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static string AddSelfEntry(List<Entry> items)
{
Here entry is
public class Entry
{
public string name;
public string metrics;
public int entry;
public bool recommended;
public string color;
//{"name":"Sugary Drinks","metrics":"times","entry":1,"recommended":false,"$$hashKey":"00F"}
}
I am getting error at console:
No breakpoint hit at webmethod in debugmode.
Please help where I am wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire