Create method in component to return JSON:
public function checkusernameavailability()
{
try {
if($username = JRequest::getVar("username","","get","cmd"))
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName("id"))->where($db->quoteName("username")."=".$username);
$db->setQuery($query);
$result = $db->loadObjectList();
if(!$result)
{
throw new Exception($username.JText::_( 'COM_USERS_PROFILE_USERNAME_MESSAGE' ));
}
}
else
{
throw new Exception("");
}
}
catch (Exception $ex)
{
echo new JResponseJson($ex);
}
echo new JResponseJson(true);
}
Make a request that looks like this: http://localhost/site/index.php/option=com_component&task=parents.checkusernameavailability
return JSON with either 200 or 500 error
Save for brevity <html lang="en-gb" dir="ltr"
This result is within'
class='com_content view-article itemid-444 j34 mm-hover'>............................<small>Sorry! The page you are looking for</small><br> Not Found
Joomla 3.4
Labels |
Added:
?
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-03-06 11:39:39 |
Closed_By | ⇒ | brianteeman |
Please use the mailing list to discuss issues with your custom component
https://groups.google.com/forum/#!forum/joomla-dev-general
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9313.