jQuery Ajax works in Firefox, fails in IE when calling Controller action

Posted by myaesubi on Stack Overflow See other posts from Stack Overflow or by myaesubi
Published on 2010-04-14T16:21:52Z Indexed on 2010/04/14 16:23 UTC
Read the original article Hit count: 327

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX