jQuery(document).ready(function($) { //Added JS {Kolawole Balgun} $('.eachstepheader').click(function(){ var activatedEventElement = $(this); $('.eachstepcontent').stop().animate({ height : 0 }); if($(this).next().height() == 0){ $(this).next().hide(); var autoheight = $(this).next().css('height', 'auto'); var curheight = $(this).next().height(); var zeroheight = $(this).next().css('height', '0px'); $(this).next().show(); $(this).next().stop().animate({ height : curheight + 70 }, function(){ $('.expand_collapse_icon', activatedEventElement).html('-'); }); }else{ $(this).next().stop().animate({ height : 0 }, function(){ $('.expand_collapse_icon', activatedEventElement).html('+'); }); } }); //Form Validation //Personal Details Validation $('#save_personal_details').click(function(){ var dd_title = $('#dd_title').val(); var lname = $('#lname').val(); var fname = $('#fname').val(); var placeofb = $('#placeofb').val(); var dd_dbirth = $('#dd_dbirth').val(); var mm_name = $('#mm_name').val(); var dd_occupa = $('#dd_occupa').val(); var dd_gender = $('input[name=dd_gender]:checked', '#frm_quote').val(); var dd_mstatus1 = $('input[name=dd_mstatus1]:checked', '#frm_quote').val(); if(required(dd_title, 'dd_title', '', '', '', '')){ $('#personal_details_msg').html("ERROR: Please, select your title."); }else if(required(lname, 'lname', '', '', '', '')){ $('#personal_details_msg').html("ERROR: Please, type your last name."); }else if(required(fname, 'fname', '', '', '', '')){ $('#personal_details_msg').html("ERROR: Please, type your other name."); }else if(required(placeofb, 'placeofb', '', '', '', '')){ $('#personal_details_msg').html("ERROR: Please, type your place of birth."); }else if(required(dd_dbirth, 'dd_dbirth', '', '', '', '')){ $('#personal_details_msg').html("ERROR: Please, type your date of birth."); }else if(dateField(dd_dbirth, 'dd_dbirth', '', '', '', '')){ $('#personal_details_msg').html("ERROR: Please, type a valid date of birth."); }else if(required(mm_name, 'mm_name', '', '', '', '')){ $('#personal_details_msg').html("ERROR: Please, your mothers maiden name."); }else if(required(dd_occupa, 'dd_occupa', '', '', '', '')){ $('#personal_details_msg').html("ERROR: Please, select your occupation."); }else if(!dd_gender){ $('#personal_details_msg').html("ERROR: Please, select your gender."); }else if(!dd_mstatus1){ $('#personal_details_msg').html("ERROR: Please, select marital status."); }else{ $('#personal_details_msg').html(""); //todo on valid form alert('Personal Details Fine'); } //End Personal Details Validation }); //Contact Details Validation ///////////////////////////// $('#save_contact_details').click(function(){ var lphone = $('#lphone').val(); var gsm = $('#gsm').val(); var femail = $('#femail').val(); var fax = $('#fax').val(); var comm_addr = $('input[name=comm_addr]:checked', '#frm_quote').val(); var address1 = $('#address1').val(); var postaddr1 = $('#postaddr1').val(); if(required(lphone, 'lphone', '', '', '', '')){ $('#contact_details_msg').html("ERROR: Type your home number"); }else if(plainNumber(lphone, 'lphone', '', '', '', '')){ $('#contact_details_msg').html("ERROR: Type a valid home number"); }else if(required(gsm, 'gsm', '', '', '', '')){ $('#contact_details_msg').html("ERROR: Type your home number"); }else if(plainNumber(gsm, 'gsm', '', '', '', '')){ $('#contact_details_msg').html("ERROR: Type a valid home number"); }else if(required(femail, 'femail', '', '', '', '')){ $('#contact_details_msg').html("ERROR: Type your email address"); }else if(emailChecks(femail, 'femail', '', '', '', '')){ $('#contact_details_msg').html("ERROR: Type a valid email address"); }else if(plainNumber(fax, 'fax', '', '', '', '')){ $('#contact_details_msg').html("ERROR: Type a valid fax number"); }else if(!comm_addr){ $('#contact_details_msg').html("ERROR: Please, select marital communication/postal address"); }else if(required(address1, 'address1', '', '', '', '')){ $('#contact_details_msg').html("ERROR: Type your current address"); }else{ $('#contact_details_msg').html(""); //todo on valid form alert('Contact Details Fine'); } }); //End Contact Details Validation //Employer Details Validation ///////////////////////////// $('#save_employer_details').click(function(){ var empname = $('#empname').val(); var empphone = $('#empphone').val(); var empaddr1 = $('#empaddr1').val(); if(plainNumber(empphone, 'empphone', '', '', '', '')){ $('#employer_details_msg').html("ERROR: Type, valid number of employer"); }else{ $('#employer_details_msg').html(""); //todo on valid form alert('Employer Details Fine'); } }); //End Employer Details Validation //Coverage Details Validation ///////////////////////////////// $('#save_coverage_details').click(function(){ var sumass = $('input[name=sumass]:checked', '#frm_quote').val(); var sumass2 = $('#sumass2').val(); var esc = $('input[name=esc]:checked', '#frm_quote').val(); var qterm_a = $('input[name=qterm_a]:checked', '#frm_quote').val(); var qterm_b = $('#qterm_b').val(); var annual_prem_a = $('input[name=annual_prem_a]:checked', '#frm_quote').val(); var annual_prem_b = $('#annual_prem_b').val(); var dd_premfrq_a = $('input[name=dd_premfrq_a]:checked', '#frm_quote').val(); var paymode = $('input[name=paymode]:checked', '#frm_quote').val(); var paymode_b = $('#paymode_b').val(); var init_contrib = $('#init_contrib').val(); if((sumass == '__o__') && (required(sumass2, 'sumass2', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type sum assured"); return; } if((plainRawNumber(sumass2, 'sumass2', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type valid sum assured"); return; } if(!esc){ $('#coverage_details_msg').html("ERROR: Choose Sum Assured Escalation"); return; } if((qterm_a == '__o__') && (required(qterm_b, 'qterm_b', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type Proposed Tenure"); return; } if((plainRawNumber(qterm_b, 'qterm_b', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type Valid Proposed Tenure"); return; } if((annual_prem_a == '__o__') && (required(annual_prem_b, 'annual_prem_b', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type Annual Contribution"); return; } if((plainRawNumber(annual_prem_b, 'annual_prem_b', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type Valid Annual Contribution"); return; } if(!dd_premfrq_a){ $('#coverage_details_msg').html("ERROR: Choose Contribution Payment Pattern"); return; } if((annual_prem_a == '__o__') && (required(annual_prem_b, 'annual_prem_b', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type Annual Contribution"); return; } if((plainRawNumber(annual_prem_b, 'annual_prem_b', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type Valid Annual Contribution"); return; } if((paymode == '__o__') && (required(paymode_b, 'paymode_b', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type Contribution Payment"); return; } if((required(init_contrib, 'init_contrib', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type Initial Contribution"); return; } if((plainRawNumber(init_contrib, 'init_contrib', '', '', '', ''))){ $('#coverage_details_msg').html("ERROR: Type Valid Initial Contribution"); return; } $('#coverage_details_msg').html(""); //todo on valid form alert('Coverage Details Fine'); }); //End Coverage Details Validation ////////// /* TABS */ ////////// $( "#users_tab" ).tabs(); /////////////////// /* DROPDOWN MENU */ /////////////////// var $menu = $('div#menu > ul > li'), $child_menu = $('div#menu > ul > li > ul > li'), $grand_child_menu = $('div#menu > ul > li > ul > li > ul > li'), $down_arrow = "▼", $up_arrow = "▲", $left_arrow = "◄", $right_arrow = "►"; $menu.find('ul').hide(); /* First List */ $menu.has('ul').children('a').append('  ' + $down_arrow); $menu.on('mouseenter',function(){ $(this).children('a').css({'background-color':'#777','color':'#FFF'}); $(this).children('ul').show(); }); $menu.on('mouseleave',function(){ $(this).children('a').css({'background-color':'transparent','color':'#777'}); $(this).children('ul').hide(); }); /* Second List */ $child_menu.has('ul').children('a').append("  " + $right_arrow + ''); $child_menu.on('mouseenter',function(){ $(this).children('a').css({'background-color':'#777','color':'#FFF'}); $(this).children('ul').show(); }); $child_menu.on('mouseleave',function(){ $(this).children('a').css({'background-color':'transparent','color':'#E2E2E2'}); $(this).children('ul').hide(); }); /////////////////// /* SEARCH BUTTON */ /////////////////// $('#search .search_box #txt_search').on('focus', function(){ $(this).animate({'width':'155px'}); }) $('#search .search_box #txt_search').on('blur', function(){ $(this).animate({'width':'55px'}); }) //////////////////////// /* General Formatting */ //////////////////////// $('#ui li a').on('mouseenter', function() { $(this).css({ 'background-image':'images/interface/prelogin/blind.png', 'background-repeat':'repeat' }); }); // Prevent default behaviour in UI Blocker $( "#ui_header div ul li a" ).on('click', function($this) { $this.preventDefault(); }); // Repositioning the UI Blocker $(window).on('resize', function() { // Don't reposition if the ui blocker is maximized if($ui_engine.config.status != 'maximized') { // Reposition the ui blocker clearTimeout($.data(this, "scrollTimer")); $.data(this, "scrollTimer", setTimeout(function() { $ui_engine.preload_ui(); }, 250)); } if($ui_engine.config.status == 'maximized') { // Resize the UI clearTimeout($.data(this, "scrollTimer")); $.data(this, "scrollTimer", setTimeout(function() { $('#ui').animate({ 'width' :$('#ui_bg').width(), 'height' :$('#ui_bg').height(), 'top' :'0', 'left' :'0' }); }, 250)); } }); $(window).on('scroll', function() { // Don't reposition if the ui blocker is maximized if($ui_engine.config.status != 'maximized') { clearTimeout($.data(this, "scrollTimer")); $.data(this, "scrollTimer", setTimeout(function() { $ui_engine.preload_ui(); }, 250)); } }); //////////////// //* Checkbox *// //////////////// $('.chk_cloak').each(function() { if($(this).is(':checked')) { $(this).parent('.chk_icon').css({'background-position':'-48px 0'}).parents('.chkbox').addClass('checked'); } else { $(this).parent('.chk_icon').css({'background-position':'-24px 0'}).parents('.chkbox').addClass('checked'); } }).on('click', function(){ if($(this).is(':checked')) { $(this).parent('.chk_icon').css({'background-position':'-48px 0'}).parents('.chkbox').addClass('checked'); } else { $(this).parent('.chk_icon').css({'background-position':'-24px 0'}).parents('.chkbox').removeClass('checked'); } }); /////////////////// // Radio Button *// /////////////////// $('.rad_cloak').each(function() { if($(this).is(':checked')) { $(this).parent('.rad_icon').css({'background-position':'-168px 0'}).parents('.radbox').addClass('checked'); } else { $(this).parent('.rad_icon').css({'background-position':'-144px 0'}).parents('.radbox').addClass('checked'); } }).on('click', function(){ if($(this).is(':checked')) { var $name = $(this).attr('name'); $('input[name='+ $name +']').parent('.rad_icon').css({'background-position':'-144px 0'}).parents('.radbox').removeClass('checked'); $(this).parent('.rad_icon').css({'background-position':'-168px 0'}).parents('.radbox').addClass('checked'); } }); }); var $ui_engine = { block: function($settings) { $.extend(this.config,$settings); $( "#ui_title" ).html(this.config.title); $( "#ui_content" ).height(this.config.height - 30); $( "#ui_content" ).load('prelogin_utils/' + this.config.file + '.php'); this.preload_ui(); //this.draggable('#ui'); $( "#ui_bg" ).fadeIn('slow', function() { $( "#ui" ).fadeIn('fast'); }); }, config: { title: 'Application', file: 'default', width: '600', height: '400', status: 'default', buttons: 'YYY' //minimize_maximize_close }, close: function() { // Hide the blinder $('#ui').fadeOut('slow', function() { $('#ui_bg').fadeOut('fast'); // The resize method image (toggle_size()) var $resize_btn = $('#ui ul li').eq(1).children('a'); $resize_btn.css({'background-position':'-33px 0'}); $resize_btn.attr('title', 'Maximize'); $ui_engine.config.status = 'default'; }); }, toggle_size: function() { if (this.config.status == 'default') // the "minimized" keyword is reserved { $( "#ui_content" ).height($('#ui_bg').height()); $('#ui').animate({ 'width' :$('#ui_bg').width(), 'height' :$('#ui_bg').height(), 'top' :'0', 'left' :'0' }, function() { // Enlarge the screen var $resize_btn = $('#ui ul li').eq(1).children('a'); $resize_btn.css({'background-position':'-99px 0'}); $resize_btn.attr('title', 'Restore Down'); // Set status to "maximized" $ui_engine.config.status = 'maximized'; }); } else if (this.config.status == 'maximized') { this.cleanup_size(); var $w, $h; $w = (($(window).width() / 2) - (this.config.width / 2)), $h = (($(window).height() / 2) - (this.config.height / 2)); $('#ui').animate({ 'width' :this.config.width, 'height' :this.config.height, 'top' :$h, 'left' :$w }, function() { // Enlarge the screen var $resize_btn = $('#ui ul li').eq(1).children('a'); $resize_btn.css({'background-position':'-33px 0'}); $resize_btn.attr('title', 'Maximize'); // Set status to "maximized" $ui_engine.config.status = 'default'; }); } }, toggle_fold: function() { alert('minimize?'); }, cleanup_size: function() { // Width manager if(this.config.width < 400) { this.config.width = 400; } // Height manager if(this.config.height < 100) { this.config.height = 100; } }, preload_ui: function() { // The resize method image (toggle_size()) var $resize_btn = $('#ui ul li').eq(1).children('a'); $resize_btn.css({'background-position':'-33px 0'}); $resize_btn.attr('title', 'Maximize'); $ui_engine.config.status = 'default'; this.preload_buttons(); var $w, $h, $ui = $('#ui'); this.cleanup_size(); // Centralize DIV $ui.css({ 'width' :this.config.width + 'px', 'height' :this.config.height + 'px', }); $w = (($(window).width() / 2) - ($ui.outerWidth() / 2)), $h = (($(window).height() / 2) - ($ui.outerHeight() / 2)) + $(window).scrollTop(); $ui.animate({ 'left' :$w + 'px', 'top' :$h + 'px', 'position' :'absolute' }); }, draggable: function(element) { element = $(element); // Move the element by the amount of change in the mouse position var $move = function(event) { if(element.data('mouseMove')) { var change_X = event.clientX - element.data('mouseX'); var change_Y = event.clientY - element.data('mouseY'); var new_X = parseInt(element.css('left')) + change_X; var new_Y = parseInt(element.css('top')) + change_Y; element.css('left', new_X); element.css('top', new_Y); element.data('mouseX', event.clientX); element.data('mouseY', event.clientY); } } element.mousedown(function(event) { element.data('mouseMove', true); element.data('mouseX', event.clientX); element.data('mouseY', event.clientY); }); element.parents(':last').mouseup(function() { element.data('mouseMove', false); }); element.mouseout($move); element.mousemove($move); }, preload_buttons: function() { // Fetch the button status var $btn = this.config.buttons; // Buttons $min = $btn[0]; $max = $btn[1]; $close = $btn[2]; if ($min == 'N') // Deactivate the Minimize button { var $min_btn = $('#ui ul li').eq(0).children('a'); $min_btn.css({ 'background-position':'0 30px', 'cursor':'default' }); $min_btn.attr({ 'title':'', 'onclick':'' }); } if ($max == 'N') // Deactivate the Maximize button { var $max_btn = $('#ui ul li').eq(1).children('a'); $max_btn.css({ 'background-position':'-33px 30px', 'cursor':'default' }); $max_btn.attr({ 'title':'', 'onclick':'return false' }); } if ($close == 'N') // Deactivate the Maximize button { var $close_btn = $('#ui ul li').eq(2).children('a'); $close_btn.css({ 'background-position':'-66px 30px', 'cursor':'default' }); $close_btn.attr({ 'title':'', 'onclick':'' }); } } }, $user_auth = function($form) { // Init. var $id = uppercase($form.loginid.value), //$pass = uppercase($form.loginpass.value); $pass = $form.loginpass.value; if ($id != "") { if ($pass != "") { // Assigning values back to form $form.loginid.value = $id; $form.loginpass.value = $pass; $.ajax({ url: "prelogin_utils/switch.php", type: "GET", data: {'opt':'auth','id':$id,'pass':$pass}, dataType: "json", success: function($json) { /* if($json.status == "true") { $('#login_msg').html("" + $json.msg + ""); $form.action = iesurl + "iesmain.php?targ=login&op=&act="; $form.submit(); } */ if($json.status == "true") { $.ajax({ url: "prelogin_utils/ajax_val1.php", type: "GET", dataType: "json", success: function($json2) { alert if($json2.status == "true") { security_question_blocker(); } else{ $('#login_msg').html("" + $json.msg + ""); //$form.action = iesurl + "iesmain.php?targ=login&op=&act="; //$form.submit(); logindata = {'loginid':$id, 'loginpass':$pass}; proc_console(iesurl + "iesmain.php?targ=login&op=&act=", logindata); } }, error: function(request, status, error) { //alert(request.responseText); $('#login_msg').html("LOGIN ERROR: Please, Try Again."); } }) } else if($json.expired == "true"){ //alert('Password Has Expired!:-)'); change_expired_password_blocker(); } else{ $('#login_msg').html("" + $json.msg + ""); } }, error: function(request, status, error) { //alert(request.responseText); $('#login_msg').html("LOGIN ERROR: Please, Try Again."); } }) } else { $('#login_msg').html("ERROR: Please, Enter Your Password."); $form.loginpass.focus(); } } else { $('#login_msg').html("ERROR: Please, Enter Your Login ID."); $form.loginid.focus(); } }, $submit_access = function(){ alert("yes"); } $securityquest_save = function($form) { var savok = true; var checkAllArguments = function() { var len = arguments.length; var obj; if(len == 0) { return true; } else { if(arguments[0] == null) { return false; } else { obj = arguments[0]; } } for(var i=1; i" + $json.msg + ""); $form.action = iesurl + "iesmain.php?targ=login&op=&act="; $form.submit(); } else{ $('#login_msg').html("" + $json.msg + ""); } }, error: function(request, status, error) { $('#login_msg').html("" + $json.msg + ""); } }); } }, $security_auth = function($form) { // Init. var $qcode = $form.qcode.value, $qresp = $form.qresponse.value; $userid = $form.userid.value; //alert($qresp+' '+$qcode+' '+$userid); if ($qcode != "") { if ($qresp != "") { // Assigning values back to form $form.qcode.value = $qcode; $form.qresponse.value = $qresp; $form.userid.value = $userid; $.ajax({ url: "prelogin_utils/switch.php", type: "GET", data: {'opt':'sec_auth','userid':$userid,'id':$qcode,'pass':$qresp}, dataType: "json", success: function($json) { if($json.status == "true") { //change_expired_password_blocker(); $('#login_msg').html("" + $json.msg + ""); $form.action = iesurl + "iesmain.php?targ=login&op=&act="; $form.submit(); } else{ $('#login_msg').html("" + $json.msg + ""); } }, error: function(request, status, error) { //alert(request.responseText); $('#login_msg').html("LOGIN ERROR: Please, Try Again."); } }) } else { $('#login_msg').html("ERROR: Please, Enter Your Security Answer."); $form.loginpass.focus(); } } else { $('#login_msg').html("ERROR: Unable to generate Security Question."); $form.loginid.focus(); } }, $chg_password = function($form){ var oldpass = $form.oldpassword.value, newpass = $form.newpassword.value, confirmpass= $form.confirmpass.value, $url = "change_pass.php"; if (oldpass == "") { alert("Please Enter Your Old Password"); oldpass.focus(); } else if (newpass.value == "") { alert("Please Enter Your New Password"); newpass.focus(); } else if (confirmpass.value == "") { alert("Please Re-Enter Your New Password"); confirmpass.focus(); } else if (newpass != confirmpass) { alert("Inconsistency in new password ...\n Please Re-Enter New Password"); confirmpass.focus(); } $conf = confirm('Please Confirm Password Change Request'); if($conf){ $.ajax({ url: $url, type: "POST", data: { 'act' : 'pwsave', 'oldpwd' : oldpass, 'newpwd' : newpass, 'newpwd2' : confirmpass, 'ajaxRec' : "true" }, dataType: "json", success: function($json) { if($json.status == "true") { //$('#login_msg').html("" + $json.msg + ""); alert($json.msg); //login_blocker(); interface_close(); } else{ $('#password_msg').html("" + $json.msg + ""); } }, error: function(request, status, error) { $('#password_msg').html("" + $json.msg + ""); } }); } } $get_access = function($form, $mode, $quicksignup, $id) { //Check Button State var activatedelement = $('#' + $id); var currentClassName = $(activatedelement).attr('class'); if (currentClassName.indexOf('dim__X__123') == -1){ // Init. if(!$quicksignup){ var $chk_agtbro = (($form.chk_agtbro.checked) || ($form.chk_agtbro.value == 'checked')) ? 'checked': '', $chk_staff = (($form.chk_staff.checked) || ($form.chk_staff.value == 'checked')) ? 'checked': '', $chk_client = (($form.chk_client.checked) || ($form.chk_client.value == 'checked')) ? 'checked': '', $chk_mgt = (($form.chk_mgt.checked) || ($form.chk_mgt.value == 'checked')) ? 'checked': '', $ccompany = $form.ccompany.value; } var $csurname = $form.csurname.value, $cothname = $form.cothname.value, $cemail = $form.cemail.value, $cgsm = $form.cgsm.value, $url = "prelogin_utils/switch.php"; // User Type (At least one must be selected) if (($chk_agtbro == '') && ($chk_staff == '') && ($chk_client == '') && ($chk_mgt == '')) { $('#access_msg').html("ERROR: Please, Select at least, one User Type."); return false; } // Surname (Must not be empty) else if ($csurname == '') { $('#access_msg').html("ERROR: Please, Enter Your Surname."); $form.csurname.focus(); return false; } // Other Names (Must not be empty) else if ($cothname == '') { $('#access_msg').html("ERROR: Please, Enter Your Other Names."); $form.cothname.focus(); return false; } // Email (Must not be empty) else if ($cemail == '') { $('#access_msg').html("ERROR: Please, Enter Your Email Address."); $form.cemail.focus(); return false; } // Phone (Must not be empty) else if ($cgsm == '') { $('#access_msg').html("ERROR: Please, Enter Your Phone Number."); $form.cgsm.focus(); return false; } //Deactivate btn $(activatedelement).addClass('dim__X__123'); // Company (Set a defaul value if it is empty) if ($ccompany == '') { $ccompany = '- -'; } //Client Quick Sign Up if($quicksignup){ $chk_agtbro == ''; $chk_staff == ''; $chk_client == 'checked'; $chk_mgt == ''; $url = "prelogin_utils/quicklogin_processor.php"; $act = 'testrequest' } $.ajax({ url: $url, type: "POST", data: { 'act' : 'testrequest', 'cb_client' : $chk_client, 'cb_agency' : '', 'cb_staff' : '', 'cb_manage' : '', 'csurname' : $csurname, 'cothname' : $cothname, 'ccompany' : '', 'cemail' : $cemail, 'cgsm' : $cgsm, 'requestid' : '', 'txt_message' : 'Save my details', 'subjectm' : '' }, dataType: "html", success: function($html) { //todo code on success: $(activatedelement).removeClass('dim__X__123'); product_blocker(blocker_title,blocker_calculatorfile); }, error: function(request, status, error) { //alert(request.responseText); $(activatedelement).removeClass('dim__X__123'); $('#access').html("ACCESS ERROR: Please, Try Again."); } }); } }; var $generate_client = function ($dob, $id){ //Check button state var activatedelement = $('#' + $id); var currentClassName = $(activatedelement).attr('class'); if (currentClassName.indexOf('dim__X__123') == -1){ $(activatedelement).addClass('dim__X__123'); if($dob != "" || $dob.replace(/\s+/g, ' ') == ' '){ var url = "prelogin_utils/generateuser.php"; $.ajax({ url: url, type: "GET", data: { 'gen':'1', 'dbirth': $dob }, dataType: "html", success: function(html) { //On success successful_client(); }, error: function(request, status, error) { //On Error } }); } } return false; }