problem using jquery ajax
Hello all,
I was trying to use ajax functionality of jquery and was not successful. I was trying to print data from test.php in query.php.
--------------------query.php-------------------------------------
<script>
function retreiveData(){
$.ajax({
url: 'test.php',
type: "GET",
contentType: 'text',
cache: false,
error: function(e,xhr){
alert('error getting data');
},
success: function(data){
alert(data);
}
});
}
</script>
-------------------test.php-----------------------------
<?PHP
header('Content-type: text');
$data= array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);
//echo $data;
return $data;
?>
Please help me to get out of this situation. I am actually using jquery for other effects in my website and also want to use it for ajax purpose.
Thanks all