-
-
Save dpriest/3197511 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class userActions extends sfActions | |
{ | |
public function executeCheckUsername(sfWebRequest $request) | |
{ | |
$username = $request->getParameter('username'); | |
$availability = (bool) Doctrine_Core::getTable('User')->checkUsername($username); | |
return $this->renderText(json_encode($availability); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$.get( | |
'<?php echo url_for('ajax_check_username'); ?>', | |
{ | |
username: $('input#username').val() | |
}, | |
function(data) | |
{ | |
// do stuff here | |
} | |
); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ajax_check_username: | |
url: /user/checkusername | |
param: { module: user, action: checkUsername } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment