JQuery AJAX调用MVC操作,询问Windows Server 2008R2中的凭据 [英] JQuery AJAX Call to MVC action , asking the Credentials in Windows Server 2008R2

查看:79
本文介绍了JQuery AJAX调用MVC操作,询问Windows Server 2008R2中的凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jquery ajax POST到MVC Action(返回动作结果)。在那个i中从DB中回溯记录并在Session中存储并返回部分视图结果。在我的机器上运行良好,当它在Windows Server 2008 R2中部署时,浏览器中会出现一个弹出窗口,要求我输入凭据(需要验证)。



jquery致电:

---------------



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

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

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

$(' #divwait')。show();
// console.log('发送请求之前'');
},
错误:function(){
// console.log(错误处理请求...);
},
成功:函数(数据){
调试器;
// console.log(已成功处理的请求...);
$(' #search-result')。html(data);
$(' #search-result')。show();

$(' #divwait')。hide();
$( #validation)。html( );

if ($(data).html()== ' < span class =code-string> \ n未找到记录\ n'){
$(' #divresetCancel')隐藏();
}
其他 {
$(' #divresetCancel')表示();
}


}

});



MVC行动:

------------





[HttpPost]

  public  ActionResult PromotionsSearch(字符串列表,字符串查询)
{

// 代码到从数据库中检索数据。

会话[ SearchPerameters] = objSearchPerameters;

return PartialView( PromotionsGrid,促销活动);

}







我提到[this] [1]链接和停止在Session中存储数据。

即使它不起作用。



你能不能告诉我缺少的东西..



任何帮助都非常感谢。







[1]: http://stackoverflow.com/questions/ 16194828 / jquery-ajax-call-failed-with-401-unauthorized [ ^ ]

解决方案

' #SearchForm')。serialize();

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


.ajax({
url:' / PromotionManagement / PromotionsSearch'
类型:' POST'
data:data ,
beforeSend:function(xhr){


' #搜索结果)隐藏();

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][1] 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.



[1]: http://stackoverflow.com/questions/16194828/jquery-ajax-call-fails-with-401-unauthorized[^]

解决方案

('#SearchForm').serialize(); window.location.hash = '#/' + data;


.ajax({ url: '/PromotionManagement/PromotionsSearch', type: 'POST', data: data, beforeSend: function (xhr) {


('#search-result').hide();


这篇关于JQuery AJAX调用MVC操作,询问Windows Server 2008R2中的凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆