如何传递UserName& Ajax中的密码

时间:2015-07-16 17:30:20

标签: javascript ajax json odata

我使用自定义身份验证创建了OData服务,如何传递UserName& Ajax中的密码。请注意,如果代码没有安全性,则可以正常运行。

请帮助解决此问题

以下是我的代码

var _url = "http://localhost:49497/DataService.svc/Mst_User?$filter=Us_Name eq 'Basit' and Us_Password eq 's'&$format=json";

$.ajax({
                type: "GET",
                url: _url,
                timeout: 10000,
                async: true,
                dataType: "json",
                contentType: "application/jsonp; charset=utf-8",
                success: function (data) 
                    debugger;
                    //                   
                    if (data.d.length > 0 && data.d[0].Us_Admin == 1) {


                        var Adminrole = data.d[0].Us_AdminModule
                        var UsNo = data.d[0].Us_No


                    } else {
                        Alter(‘Login Failed’)
                    }
                },
                error: function (xhr, status, error) { // flow always comes in error callback even url returns true and this is the issue.
                        Alter(‘Login Failed’)
                }
            });
        }
    };

由于 巴西特

0 个答案:

没有答案