Reputation: 45
Controller Action is:
public ActionResult GetStatesByCountry(string countryCode)
{
return Json(DropDownHelper.GetState(countryCode).Select(x => new { value = x.Code, text x.Name }));
}
When I Debug using firebug, I got following error.
This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.
Upvotes: 2
Views: 1539
Reputation: 13640
You have to add JsonRequestBehavior.AllowGet
to the method, because the default value is DenyGet:
public ActionResult GetStatesByCountry(string countryCode)
{
return Json(DropDownHelper.GetState(countryCode).Select(x => new { value = x.Code, text x.Name }), JsonRequestBehavior.AllowGet);
}
Upvotes: 1
Reputation: 431
Use JsonRequestBehavior.AllowGet
return Json(DropDownHelper.GetState(countryCode).Select(x => new { value = x.Code, text = x.Name }), JsonRequestBehavior.AllowGet);
Upvotes: 3