wtkd

Untitled

Sep 3rd, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. window.Form = (function() {
  2.   function Form(options) {
  3.     this.options = options
  4.     $('#form1 #cj_connect').click(function() {
  5.       window.open(options.ssoUrl + '/' + options.ssoKey + '/', 'sharer', 'toolbar=no, width=657, height=700');
  6.     })
  7.   }
  8.  
  9.   Form.prototype.setUser = function(attr){
  10.     if(attr){
  11.       $('#uid').val(attr.uid)
  12.       $('#nickname').val(attr.nickname)
  13.       $('#gender').val(attr.gender)
  14.       $('#email').val(attr.email)
  15.       $('#birthdate').val(attr.birthdate)
  16.     }
  17.   }
  18.  
  19.   Form.prototype.send = function () {
  20.  
  21.     form = $('#concurso-avioes #form1')
  22.  
  23.     $.ajax({
  24.       dataType: 'jsonp',
  25.       type: 'POST',
  26.       url: form.attr('action'),
  27.       data: form.serialize(),
  28.       success: function (data) {
  29.         console.log(data);
  30.       },
  31.       error: function (jhxErr) {
  32.         alert('Não foi possível enviar sua redação. Tente novamente!')
  33.       }
  34.     })
  35.   }
  36.  
  37.   return Form;
  38.  
  39. })();
Advertisement
Add Comment
Please, Sign In to add comment