You need a die(); before the closing } of the function and you might want to add the relevant php header to tell the browser it’s content-type
I wouldn’t worry about the browser returning the wrong content type.
As long as your code loading the data treats it as JSON
So for your function try this instead
function ajax_return_catalog_info() {
header('Content-type: application/json');
switch($_REQUEST['fn']) {
case 'ajax_call_1':
// do ajax method 1 here
echo json_encode($output);
break;
case 'ajax_call_2':
// do ajax method 2 here
echo json_encode($output);
break;
}
die();
}
if you don’t die you get a 0 stuck on the end as well, as it collapses back to the Ajax Call Function (which goes echo 0;die();