var dlg_html = {"html":"
Option 1: Sign up with Facebook or Google<\/p>\n\n\t\t
Option 2: Direct registration<\/p>\n\n\n\t\t
\n\t\t I agree to the\n\t\t Terms of Service<\/a>\t\t<\/p>\n\t\t<\/div>\n\n\n JOIN!<\/button><\/div><\/form>\t\t<\/div>\n\n\t <\/div>\n\t<\/div>\n<\/div>\n\n"}; $( function() { $('body').append( dlg_html.html ); }); function close_register_modal() { $('#register_modal').modal('hide'); } $( function() { $('.register-modal-form').submit( function( event ) { event.preventDefault(); $('.register-modal-form-error-message').hide(); var market_prefix = (market_p.length > 0) ? "/"+market_p : ""; var url_params = ""; $("#loader").show(); $(".register-modal-form button").attr('disabled','disabled'); $.post( market_prefix +"/users/ajax_register_js" + url_params, $('.register-modal-form').serialize(), function( data ) { var r = data['result']; console.log( data ); if( r == 'ok' ) { try { ga('send', 'event', 'jobseeker', 'signup', 'Jobseeker signup', 1); }catch(err) { console.log('No GA present for event tracking'); }; $('.register-modal-form-ok-message').show(); $('.register-modal-form .input, .register-modal-form .btn, .register-modal-form-links, .login-modal-social,.modal-body .h3 ').fadeOut(); $("#loader").hide(); return; } else { var error_html = "Please correct following errors: "; for( idx in data['errors'] ) { if( idx == 'email' ) continue; for( idx2 in data['errors'][idx] ) { error_html += "" + data['errors'][idx][idx2] + ""; } } error_html += ""; $('.register-modal-form-error-message').html(error_html).slideDown(); $(".register-modal-form button").removeAttr('disabled'); $("#loader").hide(); } } ).fail( function() { alert('An error has occured. Please try again'); } ); }); $("img.captcha").click(function(event) { event.preventDefault(); $(this).prop('src', '/captcha?' + Math.floor((Math.random()*100000)+1) ); } ); $('.login-modal-social .glyphicon-info-sign').tooltip({placement:'right'}); });