Shyju
Shyju

Reputation: 218862

msxml3.dll: The download of the specified resource has failed -When using XMLHTTP

I have a java script code snippet where i am making an XMLHTTP request to a remote server page. The below is my code

    var objXMLdom = new ActiveXObject("Microsoft.XmlDOM")
    var objXMLRecdom = new ActiveXObject("Microsoft.XmlDOM")
    objXMLdom.async = false
    var objXMLRoot = objXMLdom.createElement("root");           
    objXMLdom.documentElement = objXMLRoot;

    objXMLRoot.setAttribute("strWoCode",id);
    var objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
    strHTTP = "getDataResponse.aspx?wocode="+strWoCode+"&mode="report";     
    objXMLHttp.open("POST",strHTTP,false)
    objXMLHttp.send(objXMLdom); 

When the last line (send()) is executing,I am getting an error like " msxml3.dll: The download of the specified resource has failed." . My development machine is running on Win XP SP 2

Can anyone help to get rid of this ?

Upvotes: 4

Views: 11711

Answers (1)

jveazey
jveazey

Reputation: 5468

The problem is caused by your strHTTP variable. It needs to contain the full URL. Also, don't forget to encode your strWoCode variable to prevent URL injection.

strHttp = "http://www.mywebsite.com/getDataResponse.aspx?";
strHTTP = strHTTP + "wocode="+encodeURIComponent(strWoCode)+"&mode="report";    

Upvotes: 0

Related Questions