Hi,
I have written my code to load some content through ajax, which works perfectly,
then I thought of adding a timeout to retry the action in case it has failed or something.
here is the code :
[CODE=javascript]
var requestTimer = setTimeout(func tion() {
xmlHttp.send(po st);
}, 10000);
xmlHttp.onready statechange=fun ction () {.....;}
xmlHttp.open('P OST',url,true);
xmlHttp.setRequ estHeader("Cont ent-type", "applicatio n/x-www-form-urlencoded");
xmlHttp.setRequ estHeader("Cont ent-length", post.length);
xmlHttp.setRequ estHeader("Conn ection", "close");
xmlHttp.send(po st);
[/CODE]
but when the timeout goes into action I get (even though it works and I get the request resent):
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILU RE) [nsIXMLHttpReque st.send]" nsresult: "0x80004005 (NS_ERROR_FAILU RE)" location: "JS frame ::
I know the issue is somehow related to using xmlHttp.send twice,
but I can't think of anyways to make this work.[CODE]
I have written my code to load some content through ajax, which works perfectly,
then I thought of adding a timeout to retry the action in case it has failed or something.
here is the code :
[CODE=javascript]
var requestTimer = setTimeout(func tion() {
xmlHttp.send(po st);
}, 10000);
xmlHttp.onready statechange=fun ction () {.....;}
xmlHttp.open('P OST',url,true);
xmlHttp.setRequ estHeader("Cont ent-type", "applicatio n/x-www-form-urlencoded");
xmlHttp.setRequ estHeader("Cont ent-length", post.length);
xmlHttp.setRequ estHeader("Conn ection", "close");
xmlHttp.send(po st);
[/CODE]
but when the timeout goes into action I get (even though it works and I get the request resent):
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILU RE) [nsIXMLHttpReque st.send]" nsresult: "0x80004005 (NS_ERROR_FAILU RE)" location: "JS frame ::
I know the issue is somehow related to using xmlHttp.send twice,
but I can't think of anyways to make this work.[CODE]
Comment