Is there a way to retrieve only the array in my success
callback instead of the entire HTML page?
$.ajax({
'URL': 'getData.php',
success:function(data){
alert(data); //I'm currently getting the whole html file
}
})
getData.php
<?php
//Populate the array with database content
echo json_encode( $columns );
?>
How can I access only the contents of $columns
without the additional markup?
Note: My PHP file consists solely of PHP code.
This is what appears when using the alert
function: