Skip to content

Instantly share code, notes, and snippets.

@mbabker
Created August 22, 2013 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbabker/6312530 to your computer and use it in GitHub Desktop.
Save mbabker/6312530 to your computer and use it in GitHub Desktop.
Updated AJAX handling for app client
public function installfromweb() {
$model = $this->getModel('install');
$response = $model->installfromweb();
echo new JResponseJson($response['body'], $response['message'], $response['error']);
jexit();
}
public function installfromweb() {
//@TODO: Construct the URL by passing along all URL vars except option & task
$apps_dashboard = APPS_BASE_URL.'index.php?option=com_apps&view=dashboard&format=raw';
$response = array();
$http = JHttpFactory::getHttp();
try {
$html = $http->get($apps_dashboard);
$response['body'] = $html->body;
$response['message'] = '';
$response['error'] = false;
} catch (Exception $e) {
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
$response['message'] = $e->getMessage();
$response['error'] = true;
}
return $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment