pasar datos xml con ajax a php
Publicado por juanma (1 intervención) el 20/01/2014 14:11:42
Hola a todos!
Estoy intentando pasar datos xml a traves de ajax a php del siguiente modo
y los recibo del siguiente modo,
que estoy haciendo mal?
Estoy intentando pasar datos xml a traves de ajax a php del siguiente modo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$.ajax({
type : "POST",
url : "/php/uploadkml.php",
data : { xml: output },
dataType : "xml",
success : function(datos){
document.getElementById('dataOut').innerHTML = datos;
alert("Success");
},
error : function(datos) {
if (datos){
datakml = eval(datos);
document.getElementById('dataOut').innerHTML = datakml;
}
alert("Failed");
}
});
y los recibo del siguiente modo,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
include("conex.phtml");
$link=Conectarse();
//collect data send as XML
//$xml = file_get_contents('php://input');
$xml=$_POST['xml'];
//open a file handler with read and write permission
$fh = fopen('userinfo.kml', 'r+');
//writing XML string to the new file
fwrite($fh, $xml);
//closing the file handler
fclose($fh);
echo '' . json_encode($xml) . '';
mysql_close($link);
exit();
?>
que estoy haciendo mal?
Valora esta pregunta


0