EXTJS 자료 Ext.Ajax.request 반환 데이터 가져오기

7604 단어 request
 EXTJS
login function,   url: '/UI/HttpHandlerData/Login/Login.ashx', !


Ext.onReady(function () { login = function (target) { if (eval(document.getElementById('TxtUserName')).value == "") { alert(" ! !"); return false; } else if (eval(document.getElementById('TxtPassword')).value == "") { alert(" ! !"); return false; } else { var username = eval(document.getElementById('TxtUserName')).value; var password = eval(document.getElementById('TxtPassword')).value; Ext.Ajax.request({ url: '/UI/HttpHandlerData/Login/Login.ashx', method: 'POST', clientValidation: true, waitMsg: ' ...', waitTitle: ' ', params: { username: username, password: password }, success: function (response) { var data = Ext.decode(response.responseText); // Cookie new Extjs.cookie.set(data.userid, data.username); window.location.href = "../Page/InformationManagement/Index.html"; }, failure: function () { Ext.Msg.alert(" ", " , !"); } }); } } });

백그라운드 코드:
이것은 일반 프로세서의 코드입니다.
  public void ProcessRequest(HttpContext context)

        {





            string username = context.Request.Form["username"];

            string password = context.Request.Form["password"];

            int intUserID = 0;

            DataSet ds = saBLL.Login(username, password);



            // 

            string strResult = string.Empty;

            if (ds.Tables[0].Rows.Count > 0)

            {

                // 

                if (ds == null)

                    strResult = "{success:true,flag:false,msg:' !'}";

                // 

                else if (ds.Tables[0].Rows[0]["Password"].ToString() != password)

                    strResult = "{success:true,flag:false,msg:' !'}";

                // 

                else

                {

                    intUserID = Convert.ToInt32(ds.Tables[0].Rows[0]["AccountId"].ToString());

                    strResult = "{success:'true',flag:'true',userid:'" + intUserID + "',username:'" + ds.Tables[0].Rows[0]["LoginName"] + "'}";

                }

            }

            else

            {

                strResult = "{success:true,flag:false,msg:' !'}";

            }



            // 

            context.Response.Write(strResult);



        }

좋은 웹페이지 즐겨찾기