Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * novaCMS - jQuery Login
- * ---------------------------
- * @author Leon Hartley
- * @desc It's used to build the visual
- * elements of the CMS design.
- * @template Nova
- */
- $(document).ready(function() {
- $('form').submit(function() {
- var username = $("input#username").val();
- var password = $("input#password").val();
- if(username == "" || password == "") {
- $('.error').html('<div class="container">All fields are required! Make sure you populate each field!</div>');
- $('.error').slideDown('slow').delay(1700).slideUp('slow');
- return false;
- }
- var dataString = 'username='+ username + '&password=' + password;
- $.ajax({
- type: "POST",
- url: "index/login",
- data: dataString,
- success: function(data) {
- if(data == 'yes')
- {
- console.log('Correct details provided, logging in..');
- document.location = 'me';
- return false;
- }
- else
- {
- $('.error').html('<div class="container">The details you provided where incorrect!</div>');
- $('.error').slideDown('slow').delay(1700).slideUp('slow');
- return false;
- }
- }
- });
- return false;
- });
- });
Add Comment
Please, Sign In to add comment