Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Shelane French
Added: Jan 24, 2020 9:27 PM
Views: 4
Tags: jquery
  1. //Example: Sends an id as data to the server, save some data to the server and notify the user once it's complete.
  2. //Note that this usage - returning the result of the call into a variable - requires a synchronous (blocking) request! (async:false)
  3.  
  4. checkform = function(formData, jqForm, opt){
  5.     var chkemail = jqForm[0].wit_email.value;
  6.     valid_check = $.ajax({url: '_tools/playbook.lasso',
  7.                         global: false,
  8.                         type: 'POST',
  9.                         data: ({what: chkemail, route: 'validate', task: 'email'}),
  10.                         dataType: 'html',
  11.                         async: false}).responseText;
  12.     if(valid_check == 'true')
  13.         return true;  
  14.     else{
  15.         $('input[name=wit_email]').addClass('redtext');
  16.         $('label[for=wit_email], label[for=wit_editemail]').addClass('redtext');
  17.         return false;
  18.     }  
  19. }