Jump to content

Need Help To Debug A Code


Recommended Posts

Here is my code:

<?php
session_start();
require_once "E:/home/wn/public_html/mobile/global/header.php";
if(!isset($_SESSION['wn-reg_client']) || $_SESSION['wn-reg_client'] != "first_start" || $_SESSION['wn-reg_client'] != $_SERVER['REMOTE_ADDR']){
	$_SESSION['wn-reg_client']="first_start";
}
?>
	<link rel="stylesheet" href="<?=$public_mGlobal;?>layouts/wn-registration_page.css" type="text/css">
	<link rel="stylesheet" href="<?=$public_mGlobal;?>layouts/progress-wizard.min.css" type="text/css">
	<div data-role="page" data-title="Register :: Whatsnew" data-theme="<?=$theme;?>" id="registration_page" data-dom-cache="false">
		<?php require $mInc."pages/common/header.php";?>
		<?php require $mInc."pages/common/panels.php";?>
		<div role="main" class="ui-content">
			<div class="wn-section" id="wn-register">
				<form method="post">
					<div class="wn-registration_fixed_heading">
						<div class="wn-section_heading" id="wnrHeader">Register</div>
						<ul class="progress-indicator">
							
						</ul>
					</div>
					<?php
					if(isset($_SESSION['wn-reg_client']) && $_SESSION['wn-reg_client'] == "first_start" && !isset($_GET['client']) && !isset($_GET['validate']) || empty($_GET['client']) && empty($_GET['validate'])){
					?>
					<div class="wn-section" id="wn-register_emailSection">
						<div class="wn-section_body">
							<div id="wn-step1_section1" align="center" style="font-size:60px !important;">
								<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" class="wn-at_input">
									<legend>Choose Account Type:</legend>
									<input type="radio" name="atype" id="at_g" value="1" style="width:20px;">
									<label for="at_g">General</label>
									<input type="radio" name="atype" id="at_m" value="2" style="width:20px;">
									<label for="at_m">Merchant</label>
								</fieldset>
								<br><br>
							</div>
							<div class="wn-loader_modal"><div class="wn-loader"></div></div>
							<div id="wn-step1_section2">
								<hr/>
								<label for="email">Email ID:</label>
								<input type="text" name="email" id="email" value="" data-clear-btn="true" placeholder="youremailaddress@domain.com">
							</div>
							<div id="wn-step1_section2Actions">
								<!--<a id="wn-step1_prevBtn" class="ui-block-a ui-btn ui-btn-raised clr-primary" style="padding-top:10px; padding-bottom:10px;">Previous</a>-->
								<a id="wn-step1_nextBtn" class="ui-btn ui-btn-raised clr-primary" style="padding-top:10px; padding-bottom:10px;">Next</a>
							</div>
						</div>
					</div>
					<div id="wn-step1_msg" class="success"></div>
					<?php
					} elseif(isset($_SESSION['wn-reg_client']) && isset($_SESSION['wn-reg_step2_token']) && isset($_GET['client']) && isset($_GET['token']) && isset($_GET['validate']) && $_SESSION['wn-reg_client'] == $_SERVER['REMOTE_ADDR'] && $_SESSION['wn-reg_step2_token'] == $_GET['token'] || !empty($_GET['client']) && !empty($_GET['validate'])){
					?>
					<div class="wn-loader"></div>
					<div id="wn-reg_step2_msg"></div>
					<div class="wn-section" id="wn-register_loginSection">
						<div class="wn-section_body">
							<label for="un">Username:</label>
							<input type="text" name="un" id="un" value="" data-clear-btn="true" placeholder="Enter your desired username here">
							<label for="unCheckBtn"></label>
							<input type="button" id="unCheckBtn" value="Check Availablity" data-clear-btn="true" placeholder="">
							<label for="pwd">Password:</label>
							<input type="password" name="pwd" id="pwd" value="" data-clear-btn="true" placeholder="Enter your desired password here">
							
							<div id="wn-step2_actions" class="ui-grid-a">
								<a id="wn-step2_prevBtn" class="ui-block-a ui-btn ui-btn-raised clr-primary" style="padding-top:10px; padding-bottom:10px;">Previous</a>
								<a id="wn-step2_nextBtn" class="ui-block-b ui-btn ui-btn-raised clr-primary" style="padding-top:10px; padding-bottom:10px;">Next</a>
							</div>
						</div>
					</div>
					<div class="wn-section" id="wn-register_piSection">
						<div class="wn-section_body">
							<label for="fn">First name:</label>
							<input type="text" name="fn" id="fn" value="" data-clear-btn="true" placeholder="Enter your first name here">
							<label for="ln">Last name:</label>
							<input type="text" name="ln" id="ln" value="" data-clear-btn="true" placeholder="Enter your last name here">
							<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" id="sex">
								<legend>Gender:</legend>
								<input type="radio" name="sex" id="sex_m" value="Male">
								<label for="sex_m">Male</label>
								<input type="radio" name="sex" id="sex_f" value="Female">
								<label for="sex_f">Female</label>
								<input type="radio" name="sex" id="sex_n" value="Not Specified">
								<label for="sex_n">Not Specified</label>
							</fieldset>
							<fieldset data-role="controlgroup" data-type="horizontal" id="dob">
								<legend>Date Of Birth:</legend>
								<?php require_once $mInc."pages/addons/ymd.php"; ?>
							</fieldset>
							<fieldset data-role="controlgroup" id="d1">
								<legend>Declarations:</legend>
								<input type="checkbox" name="tos_checkbox" id="tos_checkbox" value="1"/>
								<label for="tos_checkbox">I've read and agree with the <a href="<?=$wni->getSiteConfig("tos_url");?>?refid=8">Terms & Conditions</a></label>
								<input type="checkbox" name="privacy_checkbox" id="privacy_checkbox" value="1"/>
								<label for="privacy_checkbox">I've read and accept the <a href="<?=$wni->getSiteConfig("privacy_url");?>?refid=8">Privacy Policy</a></label>
							</fieldset>
							<div class="ui-grid-a">
								<a id="wn-step3_prevBtn" class="ui-block-a ui-btn ui-btn-raised clr-primary" style="padding-top:10px; padding-bottom:10px;">Previous</a>
								<a id="wn-step3_nextBtn" class="ui-block-b ui-btn ui-btn-raised clr-primary" style="padding-top:10px; padding-bottom:10px;">Register</a>
							</div>
						</div>
					</div>
					<div class="wn-section" id="wn-register_mdSection">
						<div class="wn-section_body">
							<label for="bl"><green>*</green> Business Logo:</label>
							<input type="file" name="bl" id="bn" data-clear-btn="true" placeholder="Select your business logo (If any)">
							<label for="bn"><red>*</red> Business name:</label>
							<input type="text" name="bn" id="bn" data-clear-btn="true" placeholder="Enter your business name here">
							<fieldset data-role="controlgroup" data-type="horizontal">
								<legend><red>*</red> Date Founded/Established:</legend>
								<?php require $mInc."pages/addons/ymd.php";?>
							</fieldset>
							<label for="ba1"><red>*</red> Address Line-1:</label>
							<input type="text" name="ba1" id="ba1" data-clear-btn="true" placeholder="Enter the 1st address line, where your business is located">
							<label for="ba2"><green>*</green> Address Line-2:</label>
							<input type="text" name="ba2" id="ba2" data-clear-btn="true" placeholder="Enter the 2nd address line, where your business is located (if any)">
							<label for="bas"><red>*</red> Street:</label>
							<input type="text" name="bas" id="bas" data-clear-btn="true" placeholder="Enter the name of street, where your business is located">
							<label for="bal"><green>*</green> Locality:</label>
							<input type="text" name="bal" id="bal" data-clear-btn="true" placeholder="Enter the locality of your business address (if any)">
							<label for="baz"><red>*</red> Postal/ZIP Code:</label>
							<input type="number" name="baz" id="baz" data-clear-btn="true" placeholder="Enter the postal/zip code of your business address">
							<label for=""><red>*</red> :</label>
							<fieldset data-role="controlgroup">
								<legend></legend>
								<select name="bac" id="bac"><?php require $mInc."pages/addons/countries.php"; ?></select>
								<select name="bas" id="bas"></select>
								<select name="bap" id="bap"></select>
							</fieldset>
							<label for="be1"><red>*</red> Business E-mail:</label>
							<input type="email" name="be1" id="be1" data-clear-btn="true" placeholder="Enter your business email address">
							<label for="be2"><green>*</green> Additional Business E-mail:</label>
							<input type="email" name="be2" id="be2" data-clear-btn="true" placeholder="Enter your additional business email address (if any)">
							<label for="btp1"><red>*</red> Business Telephone Number:</label>
							<input type="number" name="btp1" id="btp1" data-clear-btn="true" placeholder="Enter your business telephone number">
							<label for="btp2"><green>*</green> Additional Business Telephone Number:</label>
							<input type="number" name="btp2" id="btp2" data-clear-btn="true" placeholder="Enter your additional business telephone number (if any)">
							<label for="bfn"><green>*</green> Business Fax Number:</label>
							<input type="number" name="bfn" id="bfn" data-clear-btn="true" placeholder="Enter your business fax number (if any)">
							<fieldset data-role="controlgroup">
								<legend>Declarations:</legend>
								<input type="checkbox" name="tos_checkbox" id="tcb" value="1">
								<label for="tcb">I've read and agree with the <a href="<?=$wni->getSiteConfig("tos_url");?>?refid=8">Terms & Conditions</a></label>
								<input type="checkbox" name="privacy_checkbox" id="pcb" value="1">
								<label for="pcb">I've read and accept the <a href="<?=$wni->getSiteConfig("privacy_url");?>?refid=8">Privacy Policy</a></label>
							</fieldset>
							<div class="ui-grid-a">
								<a id="wn-step4_prevBtn" class="ui-block-a ui-btn ui-btn-raised clr-primary">Previous</a>
								<a id="wn-step4_nextBtn" class="ui-block-b ui-btn ui-btn-raised clr-primary">Next</a>
							</div>
						</div>
					</div>
					<?php } ?>
				</form>
			</div>
		</div>
		<?php require $mInc."pages/common/footer.php";?>
	</div>
	<script>
	function base64_encode(s){
		var ret = null;
		$.ajax({
			method: "POST",
			url: "<?=$public_mAjax;?>/core/string_processor.php",
			data: {do: "encode_base64", string: s},
			async: false,
			success: function(d){
				if(d != null){
					ret=d;
				} else {
					ret="Failed";
				}
			},
			error: function(xhr){
				notify("error","Something went wrong! Please try again. ("+xhr.status+xhr.statusText,false+")");
			}
		});
		return ret;
	}
	function getRegType(){
		var url1="<?=$public_mAjax;?>accounts/general_account_helper.php";
		var ret = null;
		$.ajax({
			method: "POST",
			url: url1,
			data: {do: "get_type"},
			async: false,
			success: function(d){
				if(d==1 || d==2){
					ret=d;
				} else {
					ret="Failed";
				}
			},
			error: function(xhr){
				notify("error","Something went wrong! Please try again. ("+xhr.status+xhr.statusText,false+")");
			}
		});
		return ret;
	}
	$(document).ready(function(){
		var url1="<?=$public_mAjax;?>accounts/general_account_helper.php";
		$("#email").blur(function(e){
			var ve = base64_encode($("#email").val());
			if(getRegType()==1){
				$("#wn-step1_msg").html('Thank you for completing Step-1 of Whatsnew General Account Registration. You have to complete all four steps to complete your registration. we have sent the validation link to your email. Please check your e-mail and click the link in the email to proceed to the next step.<br>Please note, the email you recieve from us will be <b>accounts@whatsnew.cf</b> and the subject must be named <b>Whatsnew Accounts</b> If you didn\'t recieve an email from us, please <a href="<?=$public_mRoot;?>accounts/resend.php?f=validation_email&validate='+ve+'&type=1&&do=resend&refid=8&next=2" data-ajax="false">click here</a> to resend the verification email.');
			} else if(getRegType()==2){
				$("#wn-step1_msg").html('Thank you for completing Step-1 of Whatsnew Merchant Account Registration. You have to complete all four steps to complete your registration. we have sent the validation link to your email. Please check your e-mail and click the link in the email to proceed to the next step.<br>Please note, the email you recieve from us will be <b>accounts@whatsnew.cf</b> and the subject must be named <b>Whatsnew Accounts</b> If you didn\'t recieve an email from us, please <a href="<?=$public_mRoot;?>accounts/resend.php?f=validation_email&validate='+ve+'&type=2&do=resend&refid=8&next=2" data-ajax="false">click here</a> to resend the verification email.');
			} else {
				
			}
		});
		var at=null;
		$("#wn-step1_section2").hide();
		$("#wn-step1_section2Actions").hide();
		$("#wn-step1_msg").hide();
		$("#wn-register_emailSection .wn-section_body .wn-loader_modal").hide();
		$(".wn-at_input input").click(function(){
			$("#wn-register_emailSection .wn-section_body .wn-loader_modal").fadeIn();
			$.ajax({
				method: "POST",
				url: url1,
				data: {do: "set_type",value: $(this).val()},
				success: function(d){
					if(d=="done"){
						$.ajax({
							method: "POST",
							url: url1,
							data: {do: "get_type"},
							success: function(r){
								if(r==1){
									at=1;
									$(".wn-registration_fixed_heading .progress-indicator").html('<li class="active" id="step1"><span class="bubble"></span>Step 1. <br><small>Account Type</small></li><li id="step2"><span class="bubble"></span>Step 2. <br><small>Login Details</small></li><li id="step3"><span class="bubble"></span>Step 3. <br><small>Personal Details</small></li>');
									$("#wn-step1_section2Actions").show();
									$("#wn-step1_section2").show();
								} else if(r==2){
									at=2;
									$(".wn-registration_fixed_heading .progress-indicator").html('<li class="active" id="step1"><span class="bubble"></span>Step 1. <br><small>Account Type</small></li><li id="step2"><span class="bubble"></span>Step 2. <br><small>Personal Details</small></li><li id="step3"><span class="bubble"></span>Step 3 <br><small>Business Details</small></li><li id="step4"><span class="bubble"></span>Step 4. <br><small>Business Verification Details</small></li>');
									$("#wn-step1_section2Actions").show();
									$("#wn-step1_section2").show();
								} else {
									notify("error",r);
								}
							},
							error: function(xhr,status,response){
								notify("error","Internal Error: <b>"+xhr.status+" "+xhr.statusText+"</b> Please contact administrator");
							},
							complete: function(){
								$("#wn-register_emailSection .wn-section_body .wn-loader_modal").fadeOut();
							}
						});
					} else {
						notify("error",d);
					}
				},
				error: function(xhr,status,response){
					notify("error","Internal Error: <b>"+xhr.status+" "+xhr.statusText+"</b> Please contact administrator");
				},
				complete: function(){
					//$("#wn-register_emailSection .wn-section_body .wn-loader_modal").fadeOut();
				}
			});
			
		});
		/****************************STEP-1******************************/
		$("#wn-step1_nextBtn").click(function(){
			$("#wn-register_emailSection .wn-section_body .wn-loader_modal").fadeIn();
			$.ajax({
				method: "POST",
				url: url1,
				data: {do: "validate",value: $("#email").val(), type: "email"},
				success: function(d){
					if(d=="passed"){
						/*$("#wn-register_emailSection").animate({left: '-=100vw'}, 3000);
						$("#wn-register_loginSection").animate({left: '-=100vw'}, 3000);
						setTimeout(function(){
							$("#wn-register_emailSection").hide();
						},3000);*/
						$("#wn-register_emailSection").animate({left: '-=100vw'}, 3000);
						setTimeout(function(){
							$("#wn-step1_msg").show();
							$("#wn-register_emailSection").hide();
						},3000);
					} else {
						notify("error",d);
					}
				},
				error: function(xhr,status,response){
					notify("error","Internal Error: <b>"+xhr.status+" "+xhr.statusText+"</b> Please contact administrator");
				},
				complete: function(){
					$("#wn-register_emailSection .wn-section_body .wn-loader_modal").fadeOut();
				}
			});
		});
	});
	</script>
	<?php
	if(!empty($_GET['client']) && !empty($_GET['validate']) && !empty($_GET['token'])){
	?>
		<script>
		/***************STEP-1 PROCESSING************/
		$(document).ready(function(){
			var url1a="<?=$public_mAjax;?>accounts/general_account_helper.php";
			var url1b="<?=$public_mAjax;?>accounts/general_account_registration.php";
			var url2a="<?=$public_mAjax;?>accounts/merchant_account_helper.php";
			var url2b="<?=$public_mAjax;?>accounts/merchant_account_registration.php";
			//$("#wn-register_piSection").css({left: '0vw'});
			//$("#wn-register_mdSection").css({left: '0vw'});
			$("#wn-register_loginSection").hide();
			$("#wn-register_piSection").hide();
			$("#wn-register_mdSection").hide();
			$("#wn-reg_step2_msg").fadeOut();
			$(".wn-loader").fadeIn();
			setTimeout(function(){
				if(getRegType()==1){
					$.ajax({
						method: "POST",
						url: url1b,
						data: {do: "process_step1", validate: "<?=$_GET['validate'];?>", client: "<?=$_GET['client'];?>", token: "<?=$_GET['token'];?>"},
						success: function(d){
							if(d=="passed"){
								at=1;
								$(".wn-registration_fixed_heading .progress-indicator").html('<li class="completed" id="step1"><span class="bubble"></span>Step 1. <br><small>Account Type</small></li><li id="step2" class="active"><span class="bubble"></span>Step 2. <br><small>Login Details</small></li><li id="step3"><span class="bubble"></span>Step 3. <br><small>Personal Details</small></li>');
								//$("#wn-step1_msg").html('Thank you for completing Step-1 of Whatsnew General Account Registration. You have to complete all four steps to complete your registration. we have sent the validation link to your email. Please check your e-mail and click the link in the email to proceed to the next step.<br>Please note, the email you recieve from us will be <b>accounts@whatsnew.cf</b> and the subject must be named <b>Whatsnew Accounts</b> If you didn\'t recieve an email from us, please <a href="accounts/resend.php?f=email&client=<?=base64_encode($_SERVER['REMOTE_IP_ADDRESS']);?>&refid=8&next=2">click here</a> to resend the verification email.');
								$("#wn-register_loginSection").fadeIn();
							} else {
								$(".wn-loader").fadeOut();
								$("#wn-reg_step2_msg").addClass("error");
								$("#wn-reg_step2_msg").html(r);
								$("#wn-reg_step2_msg").fadeIn();
								notify("error",r);
							}
						},
						error: function(xhr){
							notify("error","Internal Error: <b>"+xhr.status+" "+xhr.statusText+"</b> Please contact administrator");
						},
						complete: function(){
							$(".wn-loader").fadeOut();
						}
					});
				} else if(getRegType()==2) {
					$.ajax({
						method: "POST",
						url: url2b,
						data: {do: "process_step1", validate: "<?=$_GET['validate'];?>", client: "<?=$_GET['client'];?>", token: "<?=$_GET['token'];?>"},
						success: function(d){
							if(d=="passed"){
								at=2;
								$(".wn-registration_fixed_heading .progress-indicator").html('<li class="completed" id="step1"><span class="bubble"></span>Step 1. <br><small>Account Type</small></li><li id="step2" class="active"><span class="bubble"></span>Step 2. <br><small>Personal Details</small></li><li id="step3"><span class="bubble"></span>Step 3. <br><small>Business Details</small></li><li id="step4"><span class="bubble"></span>Step 4. <br><small>Business Verification Details</small></li>');
								//$("#wn-step1_msg").html('Thank you for completing Step-1 of Whatsnew Merchant Account Registration. You have to complete all four steps to complete your registration. we have sent the validation link to your email. Please check your e-mail and click the link in the email to proceed to the next step.<br>Please note, the email you recieve from us will be <b>accounts@whatsnew.cf</b> and the subject must be named <b>Whatsnew Accounts</b> If you didn\'t recieve an email from us, please <a href="accounts/resend.php?f=email&client=<?=base64_encode($_SERVER['REMOTE_IP_ADDRESS']);?>&refid=8&next=2">click here</a> to resend the verification email.');
								$("#wn-step3_nextBtn").text("Next");
								$("#wn-register_piSection").fadeIn();
							} else {
								$(".wn-loader").fadeOut();
								$("#wn-reg_step2_msg").addClass("error");
								$("#wn-reg_step2_msg").html(d);
								$("#wn-reg_step2_msg").fadeIn();
								notify("error",d);
							}
						},
						error: function(xhr){
							notify("error","Internal Error: <b>"+xhr.status+" "+xhr.statusText+"</b> Please contact administrator");
						},
						complete: function(){
							$(".wn-loader").fadeOut();
						}
					});
				} else {
					notify("error","Unable to get Registration Type! Please contact the Administrator.");
				}
			},2000);
		});
		</script>
	<?php } ?>
	<script>
	$(document).ready(function(){
		//var url1="<?=$public_mAjax;?>accounts/general_account_helper.php";
		var url1="<?=$public_mAjax;?>accounts/general_account_registration.php";
		var url2="<?=$public_mAjax;?>accounts/merchant_account_registration.php";
		$("#wn-register_mdSection").css({left: '100vw'});
		var t=<?=$_SESSION['wn-reg_type'];?>;
		if(t==1){
			
		} else if(t==2){
			$("#wn-step3_nextBtn").addClass("ui-disabled");
			var fe=null
				le=null,
				se=null,
				de=null,
				d1=null,
				d2=null;
			$("#fn").blur(function(){
				if($(this).val){
					if($(this).val().length >= 2 && $(this).val().length <= 48){
						var fnr=new RegExp('^([A-Z]{1})([a-z]*)?(\.)?( [a-zA-Z]*)?(\.?)$');
						if(fnr.test($(this).val())){
							fe=true;
						} else {
							fe=false;
							notify("error","Invalid First Name! First name can contain only a-z(any caps) and a single dot(.) and must start with Uppercase Character and end with Lowercase character or a single dot(.).");
						}
					} else {
						fe=false;
						notify("error","Invalid First Name Length! The length of first name must be between 2 & 48 characters.");
					}
				} else {
					fe=false;
					notify("error","First Name Empty! First name cannot be left empty. Please enter atleast your first initial.");
				}
				//validateStep2();
			});
			$("#ln").blur(function(){
				if($(this).val != null){
					if($(this).val().length >= 2 && $(this).val().length <= 48){
						var lnr=new RegExp('^([A-Z]{1})([a-z]*)?(\.)?( [a-zA-Z]*)?(\.?)$');
						if(lnr.test($(this).val())){
							le=true;
						} else {
							le=false;
							notify("error","Invalid Last Name! last name can contain only a-z(any caps) and a single dot(.) and must start with Uppercase Character and end with Lowercase character or a single dot(.).");
						}
					} else {
						le=false;
						notify("error","Invalid Last Name Length! The length of last name must be between 2 & 48 characters.");
					}
				} else {
					le=false;
					notify("error","Last Name Empty! Last name cannot be left empty. Please enter atleast your last initial.");
				}
				//validateStep2();
			});
			$("#sex input").click(function(){
				if($(this).prop("checked") == true){
					se=true;
				} else {
					se=false;
					notify("error","Gender Not Selected! Please select your gender.");
				}
				//validateStep2();
			});
			$("#dob #date").change(function(){
				if($("#dob #year option:selected").val().length==4 && $("#dob #month option:selected").val().length==2 && $("#dob #date option:selected").val().length==2){
					de=true;
				} else {
					de=false;
					notify("error","Date Of Birth Not Selected! Please select your date of birth.");
				}
				//validateStep2();
			});
			$("#d1 #tos_checkbox").change(function(){
				if($(this).prop("checked")){
					d1=true;
				} else {
					d1=false;
				}
				//validateStep2();
			});
			$("#d1 #privacy_checkbox").change(function(){
				if($(this).prop("checked")){
					d2=true;
				} else {
					d2=false;
				}
				//validateStep2();
			});
			$("#fn, #ln, #dob select, #d1 #tos_checkbox, #d1 #privacy_checkbox").change(function(){
				if(fe && le && se && de && d1 && d2){
					$("#wn-step3_nextBtn").removeClass("ui-disabled");
				} else {
					$("#wn-step3_nextBtn").addClass("ui-disabled");
				}
			});
			$("#sex input").click(function(){
				if(fe && le && se && de && d1 && d2){
					$("#wn-step3_nextBtn").removeClass("ui-disabled");
				} else {
					$("#wn-step3_nextBtn").addClass("ui-disabled");
				}
			});
			$("#wn-step3_nextBtn").click(function(){
				var dob=$("#dob #date:option:selected").val()+"-"+$("#dob #month:option:selected").val()+"-"+$("#dob #year:option:selected").val();
				/****HERE IS THE PROBLEM
				*****$.ajax is not sending/retrieving data****/
				$.ajax({
					type: "POST",
					url: url2,
					dataType: "html",
					data: {do: "process_step2",validate: "<?=$_GET['validate'];?>", client: "<?=$_GET['client'];?>", token: "<?=$_GET['token'];?>" ,fname: $("#fn").val(),lname: $("#ln").val(),sex: $("#sex input:checked").val(),dob: dob},
					success: function(d){
						if(d=="passed"){
							$("#wn-register_piSection").animate({left: '-=100vw'}, 3000);
							$("#wn-register_mdSection").animate({left: '-=100vw'}, 3000);
							setTimeout(function(){
								$("#wn-register_piSection").hide();
							},3000);
						} else {
							notify("error",d,true,20);
						}
					},
					error: function(response,status,xhr){
						notify("error","Internal Error: <b>"+xhr.status+" "+xhr.statusText+"</b>. Please contact administrator");
					}
				});
			});
		} else {
			notify("error","Unable to get Registration Type! Please contact the Administrator.");
		}
	});
	</script>
	<script>
	$(document).ready(function(){
		$("#bac").change(function(){
			var cid=$(this).attr("cid");
			$.ajax({
				method: "POST",
				url: "<?=$public_mAjax;?>cscdl.php",
				data: {cid: cid},
				success: function(d){
					$("#bas").html(d);
				},
				error: function(response,status,xhr){
					notify("error","Internal Error: <b>"+xhr.status+" "+xhr.statusText+"</b>. Please contact administrator");
				}
			});
		});
		$("#bas").on('change',function(){
			var cid=$(this).attr("cid");
			var sid=$(this).attr("sid");
			$.ajax({
				method: "POST",
				url: "<?=$public_mAjax;?>cscdl.php",
				data: {cid: cid, sid: sid},
				success: function(d){
					$("#bap").html(d);
				},
				error: function(response,status,xhr){
					notify("error","Internal Error: <b>"+xhr.status+" "+xhr.statusText+"</b>. Please contact administrator");
				}
			});
		});
	});
	</script>
<?php require_once $mGlobal."footer.php";?>
Please help me to debug the code as soon as possible.
Link to comment
Share on other sites

Let me check

 

Sir I had already searched about the problem on Google, but I couldn't find any solution, so I've created a topic in Helionet. But as you suggested, I've re-checked the link you have provided but I couldn't find anything.

 

Sir, I've just altered some line of the error block. I've added a alert("TEST") before the variable "dob" and then when I've clicked the Next button the alert dialog had shown but when I've removed the alert("TEST") from that line and added it after the variable "dob", then I've clicked the Next button the alert dialog had not shown. And even when I've removed the "dob" variable from the ajax data string and added a simple text "TEST", it worked. So I think the ajax is working fine, the problem is with the "dob" variable. But what could be the problem?

Link to comment
Share on other sites

here is the line : var dob=$("#dob #date:option:selected").val()+"-"+$("#dob #month:option:selected").val()+"-"+$("#dob #year:option:selected").val();

if I write, alert(dob), my entire function doesn't works but if I comment out or remove the variable my entire code works fine.

Link to comment
Share on other sites

SyntaxError: missing } after property list[Learn More] nd2toast.js:21:6

 

Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen.[Learn More] register.php

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end users experience. For more help http://xhr.spec.whatwg.org/ jquery-1.12.4.min.js:4:26272

 

Error: Syntax error, unrecognized expression: unsupported pseudo: option jquery-1.12.4.min.js:2:12733

 

The problem is solved.

The problem was a ":".

var dob=$("#dob #date:option:selected").val()+"-"+$("#dob #month:option:selected").val()+"-"+$("#dob #year:option:selected").val();

 

The option is a child of select elements,

var dob=$("#dob #date option:selected").val()+"-"+$("#dob #month option:selected").val()+"-"+$("#dob #year option:selected").val();

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...