Skip to content

Instantly share code, notes, and snippets.

@fidlerryan
Created May 20, 2015 14:17
Show Gist options
  • Save fidlerryan/d3ffceee60072ba8c999 to your computer and use it in GitHub Desktop.
Save fidlerryan/d3ffceee60072ba8c999 to your computer and use it in GitHub Desktop.
PHP example for Accessing the Joomla Framework via an AJAX Call
if (empty($_POST["catid"])){
$return["error"] = true;
$return["msg"] = "Unidentified category ID.";
} else {
$return["error"] = false;
$db->setQuery('SELECT title FROM #__categories WHERE id='.$_POST["catid"]);
$category = $db->loadRow();
if (is_array($category)){
if ($category[0] == "Portfolio"){
$category[0] = "Project Study";
}
$return["msg"] = $category[0];
}
}
echo json_encode($return);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment