<div class="_hedForm">
	Registration Form
</div>

<form action="" method="post" id="loginAction">
<div class="_bodyForm">
	<div class="_label">
		Email
	</div>
	<div class="_inputDiv">
		<input name="email" id="email" title="Email" type="text" class="searchfield _inpForm" autocomplete="off" />
	</div>
	<div class="_label">
		<input type="submit" name="submit" id="submit" class="_btnLog" value="Sign Up" />
		<span id="_proses"></span>
	</div>
	<div style="margin-top: 100px; text-align: center;">
		<a href="<?php echo $this->baseUrl ?>">
			<img src="<?php echo $this->baseUrl.'assets/thema/apk2020/css/images/back2.png' ?>" style="width: 60px" title="Back">
		</a>
	</div>
</div>
</form>
<script type="text/javascript">
$(document).ready(function(){
	_reg = false;
	$('#loginAction').submit(function(e){
		e.preventDefault();
		
		$('#email').removeAttr("style");
		
		_act = true;

		_email = $('#email').val();
		_email = _email.trim();
		if(_email === ''){
			$('#email').css("border", "1px solid red");
			$('#_proses').html('<span style="color: red">Email Invalid</span>');
			_act = false;
		}
		
		_cek = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(_email);
		if (_cek == false){
			$('#email').css("border", "1px solid red");
			$('#_proses').html('<span style="color: red">Email Invalid</span>');
			_act = false;
		}
		
		if(_act === false){
			return;
		}
  
		$('#_proses').html('Proses Login....');
		if(_reg != false){
			_reg.abort();
		}
		_reg = $.ajax({
		type: 'POST',
			url: '<?php echo $this->baseUrl.'login/daftar2' ?>',
			data: $(this).serialize(),
			success: function(data) {
				$('#_proses').html(data);
			}
		})
	})

})
</script>