Advertisement
Guest User

Untitled

a guest
Jan 24th, 2015
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    utils.loadJSON('http://localhost:8081/myForum/privileges',function(json){
  2.     console.log(json);
  3.       for(var i = 0, j = json.Users.length; i < j; i++){
  4.         var users = json.Users[i];
  5.         users.tempId = i;
  6.         //console.log(users);
  7.         utils.loadTemplate(
  8.           'tpl/forms/privilegesForm.html',
  9.           users,
  10.           function(template){
  11.             var submitButton = $('.input-fields-' + i + ' .submit-button'),
  12.             $formUserName = $('.input-fields-' + i +' #user-name'),
  13.             $formUserRole = $('.input-fields-' + i +' #user-role');
  14.  
  15.             console.log(users.tempId);
  16.             submitButton.on('click',function(eventData){
  17.               console.log('WBIJAM KURWA');
  18.               utils.sendData('http://localhost:8081/myForum/privilegesForm',{
  19.                 userName: $formUserName.val(),
  20.                 userRole: $formUserRole.val()
  21.               },function(response){
  22.                 console.log(response);
  23.                 if(response.success == 'true'){
  24.                  //
  25.                   alert('Done!');
  26.                 }else{
  27.                   alert('Something went wrong');
  28.                 }
  29.               });
  30.             });
  31.  
  32.           }
  33.         );  
  34.        }
  35.        
  36.      });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement