0

如果我运行以下代码,它将直接进入错误:Ajax 失败并在 Fire Bug 上显示错误 [参考错误:Ajax 失败未定义”]。请告诉我在哪里犯了错误......?它是我的 base 64 编码值姓名、邮箱、性别、密码

var encodeRname = Base64.encode(name);
var encodeRemail = Base64.encode(email);
var encodeRgender = Base64.encode(lookingfor);
var encodeRpwd = Base64.encode(Pword);
var test = '.1!qkr*';
var decodertr = Base64.decode(test);

这是我的 AJAX 要求发布

$.ajax({
    //https://www.xxxxxxxxx.com/yyyyyyyyy/zzzzzzzzzzzz.svc/InsertRegistrationDetailsoverHTTPS?AuthToken={AUTHTOKEN}&RegName={REGNAME}&selGender={SELGENDER}&UserName={USERNAME}&UserPass={USERPASS}
    url: "https://www.XXXXXXX/YYYYYY/ZZZZZZZZ.svc  /InsertRegistrationDetailsoverHTTPS?AuthToken=" + decodertr + "&RegName=" + encodeRname +  "&selGender=" + encodeRgender + "&UserName=" + encodeRemail + "&UserPass=" + encodeRpwd,
    type: "POST",
    contentType: "application/javascript",
    dataType: "jsonp",
    success: function (msg) {

    },
    error: AjaxFailed
});

function AjaxSucceeded(result) {
    alert("success");
}

function AjaxFailed(result) {
    alert('Error is : ' + result.status + ' ' + result.statusText);
}
4

1 回答 1

0

您的错误处理函数必须定义如下:

$.ajax({
    //https://www.xxxxxxxxx.com/yyyyyyyyy/zzzzzzzzzzzz.svc/InsertRegistrationDetailsoverHTTPS?AuthToken={AUTHTOKEN}&RegName={REGNAME}&selGender={SELGENDER}&UserName={USERNAME}&UserPass={USERPASS}
    url: "https://www.XXXXXXX/YYYYYY/ZZZZZZZZ.svc  /InsertRegistrationDetailsoverHTTPS?AuthToken=" + decodertr + "&RegName=" + encodeRname +  "&selGender=" + encodeRgender + "&UserName=" + encodeRemail + "&UserPass=" + encodeRpwd,
    type: "POST",
    contentType: "application/javascript",
    dataType: "jsonp",
    success: function (msg) {

    },
    error: function (error) {
        // your error handling
    }
});
于 2013-10-11T11:24:02.670 回答