I am trying to replace the current node with an updated node. But when I try to replace a node, I get "Cannot mix different threading models in document" in "insertBefore" function call. I tried "replaceChild" and "appendChild". But I got the same javascript error.
I have no idea why it is happening. Is it because of thread conflicts? Is there anybody who knows why and how to fix the following code? I'd really appreciated it.
var editedNode = getXML("get_new.do?sid="+sid);
var updatedDsource = new DataSource("UPDATED_NODE",editedNode);
var allDOM = dsource.getDocument(whole_dom);
var allDocument = allDOM.documentElement;
var total = allDocument.childNodes.length;
var currentNode = allDocument.selectSingleNode("//newItems/item[@id='"+sid+"']");
allDOM.documentElement.removeChild(currentNode);
var msgs = allDocument.childNodes;
var msg = msgs.item(0);
allDOM.documentElement.insertBefore(editDOM.documentElement,msg);
I have no idea why it is happening. Is it because of thread conflicts? Is there anybody who knows why and how to fix the following code? I'd really appreciated it.
var editedNode = getXML("get_new.do?sid="+sid);
var updatedDsource = new DataSource("UPDATED_NODE",editedNode);
var allDOM = dsource.getDocument(whole_dom);
var allDocument = allDOM.documentElement;
var total = allDocument.childNodes.length;
var currentNode = allDocument.selectSingleNode("//newItems/item[@id='"+sid+"']");
allDOM.documentElement.removeChild(currentNode);
var msgs = allDocument.childNodes;
var msg = msgs.item(0);
allDOM.documentElement.insertBefore(editDOM.documentElement,msg);