views:

286

answers:

0

Hi

I am having a problem when using the ajax function in jquery. The ajax call seems to be running fine, i.e. the code that is returning an xmldocument runs without errors. Here is that code.

Jquery code:

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()

The BackPayLoadTables.aspx page calls a method BackPayLoadTables which returns an XMLDocument correctly. However when returning to the JQuery code it enters the error: callback for some reason instead of the success: callback. Any help on this would be greatly appreciated.