$( document ).ready(function() { //alert(22); }); function checkUserId() { var userId = $('#txtUserId').val(); if(userId !='' ) { $.ajax({ url: "page_ajax/lab_signup_ajax.php", type: "post", data: {operation: 'checkUserId', userId:userId}, success:function(data) { //alert(data); if(data == 'Exist') { $('#lblchk').css({'color':'red'}); $("#btnRegister").attr("disabled", true); } else { $('#lblchk').css({'color':'green'}); $("#btnRegister").attr("disabled", false); } $('#lblchk').html(data); }, error: function (xhr, ajaxOptions, thrownError) { cwlAlert(xhr.status+': '+thrownError); } }); } else { $('#lblchk').html(''); } } function populateArea(cityMasterId) { $.ajax({ url: "page_ajax/lab_signup_ajax.php", type: "post", data: {operation:'populateArea', cityMasterId:cityMasterId}, success:function(data) { data = $.trim(data); //alert(data); return false; $('#ddlArea option:not(:first)').remove(); $('#ddlArea').append(data); $('.selectpicker').selectpicker('refresh'); }, error: function (xhr, ajaxOptions, thrownError) { cwlAlert(xhr.status+': '+thrownError); } }); } function populateCity(stateMasterId) { $.ajax({ url: "page_ajax/lab_signup_ajax.php", type: "post", data: {operation:'populateCity', stateMasterId:stateMasterId}, success:function(data) { data = $.trim(data); //alert(data); return false; $('#ddlCity option:not(:first)').remove(); $('#ddlCity').append(data); $('.selectpicker').selectpicker('refresh'); }, error: function (xhr, ajaxOptions, thrownError) { cwlAlert(xhr.status+': '+thrownError); } }); } function populateState(countryId) { $.ajax({ url: "page_ajax/lab_signup_ajax.php", type: "post", data: {operation:'populateState', countryId:countryId}, success:function(data) { data = $.trim(data); //alert(data); return false; $('#ddlState option:not(:first)').remove(); $('#ddlState').append(data); $('.selectpicker').selectpicker('refresh'); }, error: function (xhr, ajaxOptions, thrownError) { cwlAlert(xhr.status+': '+thrownError); } }); } function registerBusinessUser() { //Business Information var businessName = $('#txtBusinessName').val(); var businessDescription = $('#txtBusinessDescription').val(); //Primary Location of Business var address = $('#txtAddress').val(); var countryMasterId = $('#ddlCountry').val(); var stateMasterId = $('#ddlState').val(); var cityMasterId = $('#ddlCity').val(); var area = $('#ddlArea').val(); var pinCode = $('#txtPinCode').val(); var email = $('#txtEmail').val(); var mobile = $('#txtMobile').val(); var phone = $('#txtPhone').val(); //User Details var userName = $('#txtUserName').val(); var userMobileNo = $('#txtUserMobileNo').val(); var userEmailId = $('#txtUserEmailId').val(); var userId = $('#txtUserId').val(); var password = $('#txtUserPassword').val(); if(businessName == '') { cwlAlert('Please enter business name.'); $('#businessName').focus(); return false; } if(businessDescription == '') { cwlAlert('Please enter business description.'); $('#txtBusinessDescription').focus(); return false; } if(address == '') { cwlAlert('Please enter street.'); $('#txtAddress').focus(); return false; } if(countryMasterId == '') { cwlAlert('Please select country.'); $('#ddlCountry').focus(); return false; } if(stateMasterId == '') { cwlAlert('Please select state.'); $('#ddlState').focus(); return false; } if(cityMasterId == '') { cwlAlert('Please select city.'); $('#ddlCity').focus(); return false; } if(area == '') { cwlAlert('Please select area.'); $('#ddlArea').focus(); return false; } if(pinCode == '') { cwlAlert('Please enter pin code.'); $('#txtPinCode').focus(); return false; } if(email == '') { cwlAlert('Please enter email.'); $('#txtEmail').focus(); return false; } if(mobile == '') { cwlAlert('Please enter mobile no.'); $('#txtMobile').focus(); return false; } if(userName == '') { cwlAlert('Please enter user name.'); $('#txtUserName').focus(); return false; } if(userMobileNo == '') { cwlAlert('Please enter mobile.'); $('#txtUserMobileNo').focus(); return false; } if(userEmailId == '') { cwlAlert('Please enter email.'); $('#txtUserEmailId').focus(); return false; } if(userId == '') { cwlAlert('Please enter user id.'); $('#userId').focus(); return false; } if(password == '') { cwlAlert('Please enter password.'); $('#txtPassword1').focus(); return false; } $('#btnRegister').html('Please wait..'); $("#btnRegister").attr("disabled", true); $.ajax({ url: "page_ajax/lab_signup_ajax.php", type: "post", data: {operation:'registerBusinessUser', businessName:businessName, businessDescription:businessDescription, address:address, countryMasterId:countryMasterId, stateMasterId:stateMasterId, cityMasterId:cityMasterId, area:area, pinCode:pinCode, email:email, mobile:mobile, phone:phone, userName:userName, userMobileNo:userMobileNo, userEmailId:userEmailId, userId:userId, password:password }, success:function(data) { //alert(data); data = $.trim(data); if(data == 'EXIST') { cwlAlert('This email id is already exists. Please try to signup with another email id or logged in with this email id.'); $('#btnRegister').html('Sign up Now'); $("#btnRegister").attr("disabled", false); return false; } else { cwlAlert('Your registration has been submitted successfully.'); $('#btnRegister').html('Please wait..'); window.location.href = 'lab_login'; } }, error: function (xhr, ajaxOptions, thrownError) { cwlAlert(xhr.status+': '+thrownError); } }); }