Hi All,
Was able to find a solution, add the below header if there is any other better way please let me know
Option
withHeader(‘X-Requested-With’,‘XMLHttpRequest’,‘Content-Type’,‘application/json’);
Example
$app->group('', function(RouteCollectorProxy $group) {
$group->get('/f301', function($request, $response) {
return $this->get('view')->render($response, 'page_serverinfo.html')->withHeader('X-Requested-With','XMLHttpRequest','Content-Type','application/json');
})->setName('f301');
$group->get('/f301/{rvalue}', function($request, $response, $args) {
$am = new amServerinfo();
$type = $args['rvalue'];
$instdata = $am->getServerInfo($type);
$response->getBody()->write($instdata);
return $response->withHeader('Content-Type', 'application/json');
})->setName('f301');
});