This topic is diffrent from other "ajax to php" topics, im here using xml type php file and I want to send some data to this php file via ajax, but php is not retrieving any data from ajax. when i remove header function it gets data from ajax. here is my jQuery-ajax code;
var borcu_son = $('#borcu').val();
var borclu = $('#borclu').val();
if(borcu_son > 0){
$.ajax({
url : 'borc_takip_xml.php',
data : {'borcu_son':borcu_son,'borclu':borclu},
type: 'post',
success: function(){
alert('send successfull!');
},
error: function(){
alert('ajax failed!');
}
});
}
And php file;
<?php
header('Content-Type: text/xml; charset=UTF-8');
echo '<?xml version="1.0" encoding="UTF-8" ?>';
echo '<xml>';
?>
<?php ////////////////// BORÇ OLUŞTUĞUNDA BİLGİLERİ AJAXLA AL //////////////////
if(isset($_POST['borclu']) && isset($_POST['borcu_son'])){
$borclu = $_POST['borclu'];
$olusan_borc = $_POST['borcu_son'];
$borclu_childs = '';
$borclu_childs .= '<borclu>';
$borclu_childs .= '<isim>'.$borclu.'</isim>';
$borclu_childs .= '<tutar>'.$olusan_borc.'</tutar>';
$borclu_childs .= '</borclu>';
echo $borclu_childs;
};
echo '</xml>';
?>