This is going to be maybe to long to read but i will try to explain my problem.I have a PHP script that saves the coordinates from a draggeble div into a XML file.Im sending the coordinates trough a XMLhttpRequest. The action between the HTTPRequest and the php file is working fine. So the coordinates are going over to the php file...The coordinates saves... sometimes to the xml file. other times it removes the entire xml structure so only the header is left \[code\]<?xml version="1.0"?>\[/code\]I have found that the deleting is when Im sending to many httprequest to the php file. I thinks that's the problem. .. If I hard code the coordination's in the php-file the update works every time... but when they are coming from the request, the xml nodes gets removed.I post some code. Hope some one can see where the trouble is.the xml-file\[code\] <?xml version="1.0"?> <stickers> <sticker> <position> <x>12</x> <y>22</y> <z>100</z> </position> <text>Hello World</text> <id>200</id> </sticker> </stickers>\[/code\]The php-file that update the coordinations\[code\] <?php $xml = new DOMDocument(); $xml->load('../stickers.xml'); $xpath = new DOMXPath($xml); $resultX = $xpath->query('/stickers/sticker[id='.$_POST['textBoxID'].']/position/x'); /*Updaterar fr?n ID*/ $resultX->item(0)->nodeValue = http://stackoverflow.com/questions/15586906/$_POST['clientX']; /* Adding value from coordinations*/ $resultY = $xpath->query('/stickers/sticker[id='.$_POST['textBoxID'].']/position/y'); /*Updaterar fr?n ID*/ $resultY->item(0)->nodeValue = http://stackoverflow.com/questions/15586906/$_POST['clientY']; /* Adding value from coordinations*/ $resultZ = $xpath->query('/stickers/sticker[id='.$_POST['textBoxID'].']/position/z'); /*Updaterar fr?n ID*/ $resultZ->item(0)->nodeValue = http://stackoverflow.com/questions/15586906/$_POST['clientZ']; /* Adding value from coordinations*/ echo $xml->saveXML($resultX->item(0)); echo $xml->saveXML($resultY->item(0)); echo $xml->saveXML($resultZ->item(0)); $xml->save('../stickers.xml'); ?> \[/code\]And the JavaScript function that catch the X,Y,Z coordinations\[code\]var draggableWindow = document.getElementsByClassName('sticker-drag'), windowCount = draggableWindow.length, x, windZ = 1; function startDrag(evt) { var diffX = evt.clientX - this.parentNode.offsetLeft, diffY = evt.clientY - this.parentNode.offsetTop, that = this; this.parentNode.style.zIndex = windZ++; function moveAlong(evt) { that.parentNode.style.left = (evt.clientX - diffX) + 'px'; that.parentNode.style.top = (evt.clientY - diffY) + 'px'; }document.addEventListener("mouseup",function(e){var xmlhttp;xmlhttp=new XMLHttpRequest();xmlhttp.open("POST","/project2/php/corrdination.php",true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send("textBoxID="+e.target.parentNode.id+"&clientY="+(evt.clientY - diffY)+"&clientX="+(evt.clientX - diffX)+"&clientZ="+(windZ) );console.log((evt.clientY - diffY) + " : Y")console.log((evt.clientX - diffX) + " : X")console.log((windZ) + " : Z")}); function stopDrag() { document.removeEventListener('mousemove', moveAlong); document.removeEventListener('mouseup', stopDrag); windowClass() } function windowClass() { var windowClass = document.getElementsByClassName("sticker"); for (var i = 0; i < windowClass.length; i++) { windowClass.style.opacity="1"; } } document.addEventListener('mouseup', stopDrag); document.addEventListener('mousemove', moveAlong); } for (x = 0; x < windowCount; x += 1) { draggableWindow[x].addEventListener('mousedown', startDrag); }\[/code\]