I use the two different AJAX way to send/receive data from php file but can't get the same result
data.php
<?php
echo "hello";
?>
$.get()
if($(this).val() != '')
{
$.get(
'data.php',
{ what: $(this).val() },
function(data)
{
$('#result').html(data);
alert(data);
});
}
$.ajax()
$('#choice').change(function()
{
if($(this).val() != '')
{
$.ajax({type: GET, url: "data.php", complete: function(){alert("complete");}, success: function(data){alert(data);}, error: function(){alert("error");}});
});
}
.get() will return "hello" while .ajax() return nothing even no error.