Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xmlhttp.open gives me "Invalid syntax" error

Status
Not open for further replies.

amigo02

Programmer
Feb 19, 2003
109
I have the following code in a javascript function

function fnAction(oButton){
var objXMLHTTP= new ActiveXObject("Msxml2.XMLHTTP.4.0");
var objXmlDOM=new ActiveXObject("Microsoft.XMLDOM");

varStr="somePage.aspx";

try {
objXMLHTTP.open("POST",varStr ,false);
}
catch (errorObject)
{
alert(errorObject.description)
}
objXMLHTTP.send("");

//process the xml
...
...

objXMLHTTP=null;
}
when the page first loads and I click a button to call this function it works perfectly. But when I click the button second time without loading the page again I get "Invalid syntax" at the objXMLHTTP.open statement.
 
Is this for cliant-side or server-side javascript execution?


barcode_1.gif
 
Try taking the empty string out of the Send call.

Also, here is a thread that I posted a IE and non-IE example to: thread333-827919
That way you could make it work in other browsers also,

-T



barcode_1.gif
 
The problem with the Open call not Send. Execution does not get to the Send call at all since I get "Invalid Syntax" in Open call. Again this happens when I click the button second time after the page loaded. First click goes thru and executes nicely with no problem. But unless I refresh the page second click gives me that error.

Also thanks but I am not interested on other browsers since this is an intranet application where I can control and force the browser being used..

Note: I did try taking out empty string on Send call no effect
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top