Srivani
Srivani

Reputation: 31

JQuery AJAX Call to MVC action , asking the Credentials in Windows Server 2008R2

I have a jquery ajax POST to a MVC Action (which returns action result). In that i retrive record from DB and store in Session and return partial view result . On my machine this works well, when deployed it in Windows Server 2008 R2 , A popup appears in the browser asking me to enter credentials (authentication required).

The jquery call:

 var data = $('#SearchForm').serialize();

            window.location.hash = '#/' + data;

            $.ajax({
                url: '/PromotionManagement/PromotionsSearch',
                type: 'POST',
                data: data,
                beforeSend: function (xhr) {
                    $('#search-result').hide();
                    $('#divresetCancel').hide();

                    $('#divwait').show();
                    // console.log('before sending request...');
                },
                error: function () {
                    //console.log("error processing request...");
                },
                success: function (data) {
                    debugger;
                    //console.log("successfully processed request...");
                    $('#search-result').html(data);
                    $('#search-result').show();

                    $('#divwait').hide();
                    $("#validation").html("");

                    if ($(data).html() == '\n        No Records Found \n    ') {
                        $('#divresetCancel').hide();
                    }
                    else {
                        $('#divresetCancel').show();
                    }


                }

            });

MVC Action :

[HttpPost]

      public ActionResult PromotionsSearch(string list,string query)
        {

//code to retrive the data from DB.

 Session["SearchPerameters"] = objSearchPerameters;

 return PartialView("PromotionsGrid", Promotions);

}

I referred this link and stopped storing the data in Session. Even though it didn't work .

Can you pls suggest me what is missing..

any help can be greatly appreciated.

Upvotes: 1

Views: 666

Answers (1)

Srivani
Srivani

Reputation: 31

This issue got fixed by changing the AJAX call url: '/PromotionManagement/PromotionsSearch' [controllerName/ActionName] as 'PromotionsSearch' [Only Action Name].

Upvotes: 2

Related Questions