Hello community,
I develop a POI editor but I have a problem to get the nodeId. I already got the changesetId.
The XMLHttpRequest is successful but I get an error in the response message where I normally have the nodeId.
The error message is: “. Fatal error: Extra content at the end of the document at :2.”
It is not the whole code but I think the relevant code.
function createNewOsmNode(action){
//XML
var xmlOSM = "<\?xml version='1.0' encoding='UTF-8'\?>\n"
xmlOSM += "<osm version=\"0.6\" generator=\"OpenStreetMap server\"> \n";
xmlOSM += "<node id=\"" + nodeId + "\" changeset=\"" + changeSetId + "\" version=\"" + version + "\" lat=\"" + lat + "\" lon=\"" + lon + "\">\n";
xmlOSM += xmlNode;
xmlOSM += "</node>\n</osm>";
// Sending content
osmNode(action, xmlOSM);
}
function osmNode(action, data){
var url = host + "api/node.php";
var params = new Object();
params["action"] = action;
params["changeset_id"] = changeSetId;
params["node_id"] = nodeId;
params["comment"] = commentId;
params["userName"] = userName;
params["userPassword"] = pwd;
params["data"] = data;
document.getElementById("saving").style.visibility = "visible";
new Ajax.Request(url, {
method: 'get',
parameters: params,
onSuccess: function(transport){
var response = transport.responseText;
switch (action){
case "create":
nodeId = trim(response); //here I got the error message and not the id.
case "move":
case "update":
case "delete":
// updateOSM();
break;
}
document.getElementById("saving").style.visibility = "collapse";
return "0";
},
onFailure: function(){
document.getElementById("saving").style.visibility = "collapse";
alert("crap");
return "-1";
},
onException: function(request, exception){
document.getElementById("saving").style.visibility = "collapse";
alert("crap" + exception + request);
return "-1";
}
});
}
Any ideas ?
greet Christian