Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function()
- {
- $("input, textarea, select").not('.nostyle').uniform();
- $.validator.addMethod('regexp', function(value, element, param)
- {
- return this.optional(element) || value.match(param);
- }, 'This is not have an accepted value!');
- $("#login_form").validate({
- rules: {
- username: {
- required: true,
- minlength: 6,
- maxlength: 12,
- regexp: /^\w+$/
- },
- password: {
- required: true,
- minlength: 6,
- maxlength: 12,
- regexp: /^\w+$/
- },
- remember: {
- digits: true
- },
- },
- submitHandler: function(form)
- {
- data_string = $("#login_form").serialize();
- $.pnotify_remove_all();
- $.ajax({
- type:"POST",
- url:'login/submit',
- data:data_string,
- dataType: 'json',
- success:function (data) {
- if (data.output_status == 'Error')
- {
- $.pnotify({
- type: 'error',
- title: data.output_title,
- text: data.output_message,
- icon: 'picon icon24 typ-icon-cancel white',
- opacity: 0.95,
- history: false,
- sticker: false
- });
- }
- else if (data.output_status == 'Notice')
- {
- $.pnotify({
- title: data.output_title,
- text: data.output_message,
- icon: 'picon icon16 entypo-icon-warning white',
- opacity: 0.95,
- history: false,
- sticker: false
- });
- }
- else
- {
- $.pnotify({
- type: 'success',
- title: data.output_title,
- text: data.output_message,
- icon: 'picon icon16 iconic-icon-check-alt white',
- opacity: 0.95,
- history: false,
- sticker: false
- });
- window.location = 'ctrlpanel';
- }
- }
- });
- return false; //stop the actual form post !important!
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement