I have a problem with json result. When called from jquery, it returns the file to be saved, instead of executing the success function. A get jquery request occurs in the document.ready function.
Any help would be appreciated.
public ActionResult Locations()
{
LocationsModel lm = new LocationsModel();
return Json(lm.getPins(), JsonRequestBehavior.AllowGet);
}
I also tried:
public JsonResult Locations()
{
LocationsModel lm = new LocationsModel();
return Json(lm.getPins(), JsonRequestBehavior.AllowGet);
}
jquery looks like this:
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: this.href,
data: "{}",
dataType: "json",
success: function (msg) { getPins_success(msg); },
error: OnError
});
Thank you, Chris
Edit:
It doesnβt matter that it was a spirit. As soon as I moved the json request to another action in the controller and loaded the view, it all worked. Now I have problems with parsing, but this is another problem.
source
share