Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Verify login credentials
- *
- * @param username, password
- * @param activityElement - element in which to place activity indicator
- * @param location - location to refresh after success
- * @return none
- */
- function verify_login(username, password, activityElement, location)
- {
- $.ajax({
- type: 'POST',
- url: '<?=site_url('ajax/eval_login')?>',
- data: { username: username, password: password },
- beforeSend:function() {
- window.savedHtml = $(activityElement).html();
- $(activityElement).html('<div id="activity"></div><div class="text-center">Verifying </div>');
- $('#activity').activity(); //neteye activity indicator plugin
- },
- success:function(data) {
- data = $.parseJSON(data);
- if (data.success) {
- $(activityElement).html(window.savedHtml);
- //fades in success message then performs function
- set_message('Success!',function() {
- alert(location);
- window.location.href = "<?=site_url()?>/" + location;
- });
- } else {
- $(activityElement).html(window.savedHtml);
- set_message(data.error);
- }
- $('#activity').activity(false);
- set_clicks();
- },
- error:function(){
- set_message('<strong>Oops!</strong> Try that again in a few moments.</p>');
- $('#activity').activity(false);
- $(activityElement).html(window.savedHtml);
- }
- });
- }
- data = $.parseJSON(data);
Add Comment
Please, Sign In to add comment