English 中文(简体)
JQuery的ajax方法总是触发错误回调而不是成功回调。
原标题:Jquery ajax method always fires error: callback instead of success:

我在玩笑时使用了麻风机。 所谓“雅氏”看来是罚款的,即正在归还Xml文件的代码没有错误。 这里是该法典。

Jquery代码:

function LoadWeekDays(){
    var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async="false";
    xmlDoc.loadXML("<data><item></item></data>");
    var typeitem=xmlDoc.createElement("type"); 
    var employeeiditem=xmlDoc.createElement("employeeid");   
    var timesheetiditem=xmlDoc.createElement("timesheetid");
    typeitem.text = 1;
    employeeiditem.text = nemployeeid;
    timesheetiditem.text = ntimesheetid;
    xmlDoc.documentElement.firstChild.appendChild(typeitem);
    xmlDoc.documentElement.firstChild.appendChild(employeeiditem);
    xmlDoc.documentElement.firstChild.appendChild(timesheetiditem);

    $.ajax({
        type: "POST",
        url: "../ajax/BackPayLoadTables.aspx",
        data: xmlDoc.xml,
        dataType: "xml",
        success: function(xml) {
            alert( success );
        },
        error: function(){
            alert( error );
        }
    }); //close $.ajax(
}

<>BackPayLoadTables.aspx

    Dim xmlDoc As New XmlDocument()
    Dim xmlDocRet As New XmlDocument()
    xmlDoc.Load(Request.InputStream)
    xmlDocRet = BackPayLoadTables(xmlDoc)

    Response.Clear()
    Response.Write(xmlDocRet)
    Response.End()

BackPay LoadTables.aspx page calls a means BackPayLoad 表格正确填写了XML文件。 然而,在回到《金色法典》时,它就犯了错误:出于某种原因,而不是成功:背书。 在这方面的任何帮助将受到高度赞赏。

问题回答

嗨,在您的错误参数中执行此操作(错误:ErrorMsg,)

function ErrorMsg(result) {
        if (result.status == 200 && result.statusText ==  OK ) {
            //success code;
        }
        else {
            alert("FAILED : " + result.status +     + result.statusText);
        }
    }




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签