fastreg.js 1.34 KB
/**
 * 
 */
QRegister = {
		clickImgCode : function( nspace ,imgCodeId) {
	        var dt = new Date();
	        var group = '';
	        if(nspace){
	        	group = "&g="+nspace;
	        }
	        var imgcode = 'imgcode';
	        if(imgCodeId){
	        	imgcode = imgCodeId;
	        }
	        var src = "/passport/images?t=" + dt.getTime() + group;
	        $('#'+imgcode).attr('src', src);
	        return false;
	    },
	    showBox: function()
	    {
	    	$.get('/passport/reg/fastreg', {"return_type":"json","coupon_id":couponId,"redirect":redirect}, function(html){
	    		if(html != '')
	    		{
	    			$('#loginBox').html(html);
	    		}
	    	});
	    },
	    register:function()
	    {
	    	var username = $('#email').val();
	    	$.post('/passport/reg/auth',$('#fastregForm').serialize(),function(data){
				if(data.code == 200){
					var rd = $('#redirect').val();
					if(typeof rd == 'undefined' || rd == '')
					{
						$('#loginBox').html('<div class="loginbox2"><p><span>'+username+'</span></p></div> ');
					}else{
						location.href = rd;
					}
					return true;
				}
				alert(data.message);
				return false;
			}, 'json');
	    },
	    loginBox : function()
	    {
	    	$.get('/passport/reg/loginmenu',{}, function(html){
	    		if(html != '')
	    		{
	    			document.write(html);
	    		}
	    	});
	    }
};
QRegister.showBox();