I just wanted to check something here - do you have to echo values in PHP to retrieve them via (jQuery)XHR?
for example
PHP:
public function processRequest() {
//intercept AJAX requests
if (!empty($_GET)) {
if (isset($_GET['xhr'])) {
if ($_GET['xhr'] == true) {
//process AJAX
//call relevant method
echo json_encode(array('key' => 'value'));
return;
}
}
}
//else proceed with regular output
$this->render();
}
jQuery:
function doAjax(){
$.ajax({
url: "index.php?xhr=true",
cache: false,
dataType: 'json',
success: function(data){
console.log(data);
}
});
}
This logs a json object in Firebug console with the appropriate values. If I try and return the value instead of echoing, I get nada.