This is my first time using AJAX with ASP.NET so please allow m some rope.
I have a simple AJAX request that I wish to retuen a JSON string but ASP.NET keeps formatting the JSON string as XML
here is my code
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetModels()
{
string response;
using (var context = new myDataModel())
{
var m = from model in context.ListModels select model;
var serializer = new JavaScriptSerializer();
response = serializer.Serialize(m);
}
return response;
}
this is called but returns an XML node containing my JSON string really confused