jQuery Ajax works in Firefox, fails in IE when calling Controller action
- by myaesubi
Hello there,
I'm making the following jQuery ajax call to an action in ASP.NET MVC. In Firefox the async request is sent to the action in the controller and everything works fine, but in IE no request is sent to the controller.
Here is the ajax call and action controller signature:
$.ajax({
cache: false,
type: "GET",
dataType: "json",
contentType: "application/json; charset=utf-8",
url: "/Fmz/AssignFmzToRegion",
data: { fmzId: 403, regionId: 409 },
success: function(message) {
if (message != 'Success')
alert(message);
},
failure: function(message) {
alert(message);
}
});
[HttpGet]
public JsonResult AssignFmzToRegion(long fmzId, long regionId)
{
try
{
FacilityManagementZoneService.AssignFmzToRegion(fmzId, regionId);
}
catch (Exception e)
{
return this.Json(e.Message, JsonRequestBehavior.AllowGet);
}
return this.Json("Success", JsonRequestBehavior.AllowGet);
}
Thanks.