0
我正在使用wcf服務來驗證用戶。該服務根據用戶名/密碼是否有效返回true或false。如何將返回的值傳遞給javascript函數以決定驗證是否失敗或通過。使用wcf進行服務器端驗證的javascript函數
function AuthenticateUser(email, password, onSuccess, onFailed)
{
var person = { "Email": $("#Email").val(), "Password": $("#Password").val() };
req = $.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(person),
url: wsUrl + "/AuthenticateUser",
success: function()
{
req = null;
onSuccess();
},
error: function (jqXHR, textStatus, errorThrown) {
if (textStatus != 'abort')
onFailed(errorThrown);