Ajax call not hitting the controller action method, status 500 , Internal Server Error RRS feed

  • Question

  • My Ajax call to controller action method is not hitting the controller , it breaks in between. It says that xhr.status = 500 , response text = Internal Server Error

    The same code is working fine in other project.

    .Js code

     ajaxCall: function (data, url, success, error, noShow) {
        // make sure that there is never an empty POST body to protect against proxy allowing too soon
        if (!data) {
            data = "{'dummy':1}";
        var reqData = data;
            type: "POST",
            traditional: true,
            url: url,
            data: data,
            // switch on/off geenraic AJAX events bound globally
            /** @default false
            global: !(noShow || false),
            cache: false,
            dataType: "json",
            // add CSRF token to each request
            beforeSend: function (xhr) { /* jquery 1.5.* use headers */
                var csrf_token = $("[name=__RequestVerificationToken]").val();
                xhr.setRequestHeader('__RequestVerificationToken', csrf_token);
            contentType: "application/json",
            success: function (data) {
            error: function (a, b, c) {
                // repeat ajax call when "Empty body element" message gets returned. It means that proxy challenge was completed too soon.
                if (a.responseText == "EmptyBodyElement")
                    Service.ajaxCall(reqData, url, success, error);
                else {
                    if (error)
                        error(a, b, c);
                        Service.responseError(a, b, c);
    },I am receiving error in jQuery1.9.1

    if ( callback && ( isAbort || xhr.readyState === 4 ) ) xhr.status = 500 shr.responsetext = Internal Server Error

    The same code working in other projects , I have checked all the regrences are in place.

    Wednesday, April 2, 2014 1:45 PM