\
\\Thank you for providing your details.
\
Fill the below details in order to get better rates:
\
\
\Get a Call\
\
\\
\
I don\'t want to share further details
\';var creditCardBannerTemp = '
\
\
\
\
\
\
DO NOT LEAVE EMPTY HANDED
\
Avail assured credit card through our agents
\
Increase your chances of approval
\
\
\
\
\
\
\\
\
\\\
\
\
\
\\
\
\\
\
\\
\\Your details are safe and secured
\
\
\
\
\\
\
\\\\\
\
\
\
\\
\
\\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\\Thank you for providing your details.
\
Provide the following details to get a quick response
\
\
\Get a Call\
\
I don\'t want to share further details
\\
\
\
\
\
';var page = {};var globalCat, telInput, telScrollInput, telPhoneInput, categoryType;var category = "";var collectionUrl = "";var checkedUrl = "";var cloudinaryUrl = "https://res.cloudinary.com/mymoneysouq";var productCollectionObj = { url: null}page.apiCall = function (url, body, resultCallback) { body = body || {}; body._method = body._method || 'GET'; jQuery.ajax({ type: 'POST', url: url, data: JSON.stringify(body), contentType: 'application/json', success: function (data) { resultCallback(null, data); }, error: function (err) { resultCallback(err.responseText); } });};jQuery(window).scroll(function () { if (jQuery(this).scrollTop() > 450) { /* jQuery('#banner-page-down').addClass('banner-fixed'); jQuery('#banner-page-down').css("display","block"); jQuery('#banner-page-down1').addClass('banner-fixed'); jQuery('#banner-page-down1').css("display","block"); */ } else { jQuery('#banner-page-down').css("display", "none"); jQuery('#banner-page-down').removeClass('banner-fixed'); jQuery('#banner-page-down1').css("display", "none"); jQuery('#banner-page-down1').removeClass('banner-fixed'); }});function setBackInputNum() { telInput.intlTelInput('setNumber', jQuery("#mobileno").intlTelInput('getNumber').replace('+971' + Number(jQuery('#dialCodesSelect').val()), '+971'))}function addSalaryRange(categoryName, globalProductName, monthlyIncome, callback) { if (categoryName === 'accounts') { globalProductName = globalProductName.replace('Accounts', 'Account'); } var data = { categoryName: categoryName, globalProductName: globalProductName } page.apiCall(domain + '/api/getSalaryRangeByCategory', data, function (err, res) { if (!err && data) { var salaryRanges = res.salaryRanges; for (var i in salaryRanges) { var optionVal = salaryRanges[i].option; if (optionVal.match(/Below/) || optionVal.match(/Above/)) { if (optionVal.match(/Below/)) { var minSal = optionVal.split('Below'); minSal = minSal[1]; if (parseInt(minSal) > parseInt(monthlyIncome)) { callback(salaryRanges[i].value); } } else if (optionVal.match(/Above/)) { var maxSal = optionVal.split('Above'); maxSal = maxSal[1]; if (parseInt(maxSal) <= parseInt(monthlyIncome)) { callback(salaryRanges[i].value); } } } else { var minSal = optionVal.split('-')[0]; var maxSal = optionVal.split('-')[1]; if ((parseInt(minSal) < parseInt(monthlyIncome)) && (parseInt(monthlyIncome) <= parseInt(maxSal))) { callback(salaryRanges[i].value); } } } } })}var thankYouTemplate = '
\
\
Thank You for Providing Your Details
\
You will receive a call shortly
\
';function setThankYou() {var successMessage = `
×Your Info has been saved successfully
`; try { jQuery('#custname').val(''); jQuery('#mobileno').val(''); jQuery('#monthlyIncomeInput').val(''); jQuery('#s-message').html(successMessage); jQuery('.lead-banner-msg').html(''); var el = document.getElementById('.widget-cc-lead'); var lw = parseFloat(window.getComputedStyle(el, '').width) - 4; var lh = parseFloat(window.getComputedStyle(el, '').height) - 4; jQuery('.widget-cc-lead').prepend(thankYouTemplate); jQuery('.widget-cc-lead').css('width', lw); jQuery('.widget-cc-lead').css('height', lh); } catch (e) { }}var eventNames = { 'Personal Loan': 'PLoan', 'Home Loan': 'HLoan', 'Business Loan': 'BLoan', 'Car Loan': 'CLoan', 'Credit Card': 'CCard', 'Savings Account': 'SAccount', 'Current Account': 'CAccount', 'Deposit Account': 'DAccount', 'Islamic Account': 'IAccount', 'Sme Account': 'SmeAccount', 'Children Account': 'ChAccount', 'Premier Account': 'PAccount', 'Life Insurance': 'LInsurance', 'Car Insurance': 'CInsurance'}function setEventName(category, leadEventName) { return eventNames[category] + leadEventName;}function apiCallForBanner(matchUrl) { var bannerNameId = ""; var bannerPhoneId = ""; var salaryRangeId = ""; var tickImageId = ""; var submitMessageId = ""; var emailRegValdation = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; if (category.match(/life-insurance/gi)) { globalCat = "Life Insurance"; categoryType = 'insurance'; } if (matchUrl.match(/credit-card/i)) { globalCat = "Credit Card"; categoryType = 'cards'; assignCards(globalCat); } if (matchUrl.match(/personal-loan/i) || matchUrl.match(/personal/i)) { globalCat = "Personal Loan"; categoryType = 'loans'; } // globalCat = "Credit Card"; // categoryType = 'cards'; jQuery(document).on('click',"#callnow",function (e) { //jQuery('.cb1').css('display','none'); var years = jQuery('#jobYear').val() + ' years'; if (jQuery('#jobYear').val() != "" && jQuery('#jobYear').val() != null) { var years = jQuery('#jobYear').val() + ' years'; if (jQuery('#jobMonth').val() != "") { var months = ' - ' + jQuery('#jobMonth').val() + ' months'; var jobyears = years + months; } else { var jobyears = years; } } else { jobyears = ""; } telInput.intlTelInput("setCountry", "ae"); telInput.intlTelInput('setNumber', jQuery("#mobileno").intlTelInput('getNumber').replace('+971', jQuery('#dialCodesSelect').val())) bannerData = { "name": jQuery("#custname").val(), "phone": jQuery("#mobileno").intlTelInput('getNumber'), "requestFor": globalCat, "url": checkedUrl, "canSendEmail": false, "salaryRange": jQuery('#bannnerSalaryDesk').val(), "monthlyIncome": jQuery('#monthlyIncomeInput').val(), "nationality": jQuery('#Nationality').val(), "companyName": jQuery('#companyName').val(), "salryCreditedBank": jQuery('#bankName').val(), "currentJobYears": jobyears, "emailId": jQuery('#emailId').val(), "requiredLoanAmount": jQuery('#requiredLoanAmount').val(), "isOpted": { 'provider': 'Citi', 'opted': jQuery('#citi-check-box').is(':checked') } } jQuery("#banner-img").css("display", "none"); jQuery("#message").html(""); //console.log(jQuery("#phone").intlTelInput("setNumber", bannerData.phone)); if (bannerData.name != "") { if (telInput.intlTelInput("isValidNumber")) { if (bannerData.monthlyIncome != "" && parseInt(bannerData.monthlyIncome) >= 3000) { setBackInputNum(); var monthlyIncome = bannerData.monthlyIncome; addSalaryRange(categoryType, globalCat, monthlyIncome, function (salaryRange) { bannerData.salaryRange = salaryRange;console.log(salaryRange) var salaryRangeCheck = bannerData.salaryRange.split('-')[0]; var selectedSalary = salaryRangeCheck.slice(0, 1); if (salaryRangeCheck == "6k") { var selectedSalary = 6; } if (salaryRangeCheck == "8k") { var selectedSalary = 8; } if (salaryRangeCheck == "10k") { var selectedSalary = 10; } if (salaryRangeCheck == "15k") { var selectedSalary = 15; } if (bannerData.salaryRange == "Below 3000") { var selectedSalary = 2; } if (bannerData.salaryRange == "Above 25k") { var selectedSalary = 25; } if (bannerData.salaryRange == "Above 3000") { var selectedSalary = 30; } if (bannerData.salaryRange == "Below 200") { var selectedSalary = 2; } if (parseInt(selectedSalary) >= 5) { bannerNameId = "#custname"; bannerPhoneId = "#mobileno"; salaryRangeId = salaryRange; tickImageId = "#banner-img"; submitMessageId = "#message"; jQuery('#jobYear').val(''); jQuery('#jobMonth').val(''); jQuery('#Nationality').val(''); jQuery('#bankName').val(''); jQuery('#Nationality').append('
') for (i = 0; i <= nationalitiesList.length - 1; i++) { jQuery('#Nationality').append('
'); } jQuery('#bankName').append('
') for (i = 0; i <= brandresultName.length - 1; i++) { jQuery('#bankName').append('
'); } jQuery('#jobYear').append('
') for (i = 0; i <= 10; i++) { jQuery('#jobYear').append('
'); } jQuery('#jobMonth').append('
') for (i = 0; i <= 11; i++) { jQuery('#jobMonth').append('
'); } jQuery('#formModal').modal('show'); //bannerData = allotCardToUser(bannerData, false) //var defaultSalary = selectedSalary * multiSalaryForForm; //renderMonthlySalary(defaultSalary); page.apiCall(domain + '/api/user/request', bannerData, function (err, res) { jQuery('#sendAppLink').attr("href", domain + "/users/customers/login/lead/" + res.leadId) }); jQuery('.modal-backdrop').css('position', 'relative'); } else { page.apiCall(domain + '/api/user/request', bannerData, function (err, res) { if (!err) { jQuery("#banner-img").css("display", "block"); setThankYou(); if(res){ res.isNew ? ga('send', 'event', globalCat, setEventName(globalCat,'leadBannerClick'), bannerData.salaryRange) : ga('send', 'event', globalCat, setEventName(globalCat,'leadBannerClickUpdate'), bannerData.salaryRange); } } else { jQuery('#message').html('Error Saving Details. Please Try Again.'); } jQuery('.cb1').css('display', 'none'); }); } }); } else { setBackInputNum(); jQuery("#message").html("Invalid monthly salary"); } } else { setBackInputNum(); jQuery("#message").html("Invalid mobile number"); } jQuery("#namemessage").html(""); } else { setBackInputNum(); jQuery("#namemessage").html("Invalid name"); } }); jQuery(document).on('click',"#detailsPopupModal",function () { if (jQuery('#jobYear').val() != "" && jQuery('#jobYear').val() != null) { var years = jQuery('#jobYear').val() + ' years'; if (jQuery('#jobMonth').val() != "") { var months = ' - ' + jQuery('#jobMonth').val() + ' months'; var jobyears = years + months; } else { var jobyears = years; } } else { jobyears = ""; } var isCheckedCreditCard = jQuery('#creditChecked').is(":checked"); telInput.intlTelInput('setNumber', jQuery("#mobileno").intlTelInput('getNumber').replace('+971', jQuery('#dialCodesSelect').val())) bannerDataDetails = { "name": jQuery(bannerNameId).val(), "phone": jQuery(bannerPhoneId).intlTelInput('getNumber'), "requestFor": globalCat, "url": checkedUrl, "canSendEmail": true, "salaryRange": salaryRangeId, "nationality": jQuery('#Nationality').val(), "companyName": jQuery('#companyName').val(), "salryCreditedBank": jQuery('#bankName').val(), "currentJobYears": jobyears, "emailId": jQuery('#emailId').val(), "requiredLoanAmount": jQuery('#requiredLoanAmount').val(), "isOpted": { 'provider': 'Citi', 'opted': jQuery('#citi-check-box').is(':checked') }, "monthlyIncome": jQuery('#monthlyIncomeInput').val(), "clickEvent": "leadFormDetailClick","additionalInfo" : { "isPreferredTime" : jQuery('#preferredTimeCheck').is(':checked'), "preferredTime" : jQuery('#preferredTimeSelect').val() } } allotCardToUser(bannerDataDetails, true); if (bannerDataDetails.requestFor == 'Personal Loan' || bannerDataDetails.requestFor == 'Home Loan' || bannerDataDetails.requestFor == 'Car Loan' || bannerDataDetails.requestFor == 'Business Loan') { forloansBanner(); if (isCheckedCreditCard) { bannerDataDetails.requestFor = "Credit Card"; bannerDataDetails.url = "cards/compare-credit-cards-" + country; } } if (bannerDataDetails.requestFor == "Life Insurance") { forinsuranceBanner(); } if (bannerDataDetails.requestFor == 'Credit Card') { forcreditcards(); } if (bannerDataDetails.requestFor == 'Savings Account' || bannerDataDetails.requestFor == 'Current Account' || bannerDataDetails.requestFor == 'Deposit Account' || bannerDataDetails.requestFor == 'Islamic Account' || bannerDataDetails.requestFor == 'Premier Account' || bannerDataDetails.requestFor == 'Children Account' || bannerDataDetails.requestFor == 'Sme Account') { foraccountsBannerNew(); } function apiCommonbannerNew() { page.apiCall(domain + '/api/user/request', bannerDataDetails, function (err, res) { if (!err) { jQuery(tickImageId).css("display", "block"); setThankYou(); jQuery('#formModal').modal('hide'); if(res) { res.isNew ? ga('send', 'event', globalCat, setEventName(globalCat,'leadFormDetailClick'), bannerData.salaryRange) : ga('send', 'event', globalCat, setEventName(globalCat,'leadFormDetailClickUpdate'), bannerData.salaryRange); } } else { jQuery('#detailsBannerMessage').html('Error Saving Details! Please Try Again.'); setBackInputNum(); } jQuery('.applinkDiv').css("display", "block"); jQuery('#sendAppLink').attr("href", domain + "/users/customers/login/lead/" + res.leadId) jQuery("#detailsBannerMessage").html('\ Got your details, you will receive a call shortly') }); } function forloansBanner() { if (bannerDataDetails.nationality != "") { if (bannerDataDetails.companyName != "") { if (bannerDataDetails.salryCreditedBank != "") { if (jQuery('#jobYear').val() != "") { if (bannerDataDetails.emailId != "") { if (bannerDataDetails.emailId.match(emailRegValdation)) { if (bannerDataDetails.requiredLoanAmount != "" && jQuery.isNumeric(bannerDataDetails.requiredLoanAmount)) { apiCommonbannerNew(); } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Invalid required loan amount"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter valid email"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your email"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter number of years in current job"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter salary credited bank name"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your company name"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your nationality"); } } function forinsuranceBanner() { if (bannerDataDetails.nationality != "") { if (bannerDataDetails.nationality.match(/^[a-zA-Z\s]+jQuery/)) { if (bannerDataDetails.companyName != "") { // if(bannerDataDetails.salryCreditedBank != "" ){ //if(jQuery('#jobYear').val() != ""){ if (bannerDataDetails.emailId != "") { if (bannerDataDetails.emailId.match(emailRegValdation)) { apiCommonbannerNew() // if(bannerDataDetails.requiredLoanAmount != "" && jQuery.isNumeric(bannerDataDetails.requiredLoanAmount)){ // apiCommonbannerNew(); // }else{ // jQuery("#detailsBannerMessage").html("Invalid required loan amount"); // } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter valid email"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your email"); } } // else{ // jQuery("#detailsBannerMessage").html("Please enter number of years in current job"); // } //} // else{ // jQuery("#detailsBannerMessage").html("Please enter salary credited bank name"); // } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your company name"); } //} // else{ // jQuery("#detailsBannerMessage").html("Please enter alphabets only"); // } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your nationality"); } } function forcreditcards() { if (bannerDataDetails.emailId != "") { if (bannerDataDetails.emailId.match(emailRegValdation)) { if (bannerDataDetails.nationality != "") { if (bannerDataDetails.companyName != "") { if (jQuery('#jobYear').val() != "") { apiCommonbannerNew(); } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter number of years in current job"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your company name"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your nationality"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter valid email"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your email"); } } function foraccountsBannerNew() { if (bannerDataDetails.nationality != "") { if (bannerDataDetails.companyName != "") { if (bannerDataDetails.emailId != "") { if (bannerDataDetails.emailId.match(emailRegValdation)) { apiCommonbannerNew(); } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter valid email"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your email"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your company name"); } } else { setBackInputNum(); jQuery("#detailsBannerMessage").html("Please enter your nationality"); } } //main fun all })jQuery(document).on('click',".detailsClosePopupModal",function () { if (jQuery('#jobYear').val() != "" && jQuery('#jobYear').val() != null) { var years = jQuery('#jobYear').val() + ' years'; if (jQuery('#jobMonth').val() != "") { var months = ' - ' + jQuery('#jobMonth').val() + ' months'; var jobyears = years + months; } else { var jobyears = years; } } else { jobyears = ""; } jQuery('#formModal').modal('hide'); telInput.intlTelInput('setNumber', jQuery("#mobileno").intlTelInput('getNumber').replace('+971', jQuery('#dialCodesSelect').val())) bannerData = { "name": jQuery(bannerNameId).val().trim(), "phone": jQuery(bannerPhoneId).intlTelInput('getNumber'), "requestFor": globalCat, "url": checkedUrl, "canSendEmail": true, "salaryRange": salaryRangeId, "nationality": jQuery('#Nationality').val().trim(), "companyName": jQuery('#companyName').val().trim(), "salryCreditedBank": jQuery('#bankName').val(), "currentJobYears": jobyears, "emailId": jQuery('#emailId').val(), "requiredLoanAmount": jQuery('#requiredLoanAmount').val(), "isOpted": { 'provider': 'Citi', 'opted': jQuery('#citi-check-box').is(':checked') }, "monthlyIncome": jQuery('#monthlyIncomeInput').val(), "clickEvent": "leadFormClick","additionalInfo" : { "isPreferredTime" : jQuery('#preferredTimeCheck').is(':checked'), "preferredTime" : jQuery('#preferredTimeSelect').val() } } jQuery('#Nationality').val(""); jQuery('#companyName').val(""); jQuery('#bankName').val(""); jQuery('#jobYears').val(""); jQuery('#emailId').val(""); jQuery('#requiredLoanAmount').val(""); jQuery('#jobYear').html(""); jQuery('#jobMonth').html(""); jQuery('.applinkDiv').css("display", "none"); jQuery("#detailsBannerMessage").html("") allotCardToUser(bannerData, true); page.apiCall(domain + '/api/user/request', bannerData, function (err, res) { if (!err) { jQuery(tickImageId).css("display", "block");setThankYou(); if(res){ res.isNew ? ga('send', 'event', globalCat, setEventName(globalCat,'leadFormClick'), bannerData.salaryRange) : ga('send', 'event', globalCat, setEventName(globalCat,'leadFormClickUpdate'), bannerData.salaryRange); } } else { jQuery(tickImageId).css("display", "block"); setBackInputNum(); } }); })}function inilizeTelInput() { telInput = jQuery("#mobileno"); telInput.intlTelInput({ preferredCountries: ["ae"], geoIpLookup: function (callback) { jQuery.get('https://ipinfo.io', function () { }, "jsonp").always(function (resp) { var countryCode = (resp && resp.country) ? resp.country : ""; callback(countryCode); }); }, utilsScript: domain + "/js/common/utils.js" }); telInput.css('width', '95%'); telInput.css('padding-left', '10px'); telInput.css('margin-left', '4%'); telScrollInput = jQuery("#scrollmobileno"); telScrollInput.intlTelInput({ preferredCountries: ["ae"], geoIpLookup: function (callback) { jQuery.get('https://ipinfo.io', function () { }, "jsonp").always(function (resp) { var countryCode = (resp && resp.country) ? resp.country : ""; callback(countryCode); }); }, utilsScript: domain + "/js/common/utils.js" }); jQuery('#scrollmobileno').parent('div .intl-tel-input').css('width', '17%') jQuery('#scrollmobileno').css('margin-left', '3%') telScrollInput.css('width', '100%'); telScrollInput.css('padding-left', '10px'); telPhoneInput = jQuery("#phonemobileno"); telPhoneInput.intlTelInput({ preferredCountries: ["ae"], geoIpLookup: function (callback) { jQuery.get('https://ipinfo.io', function () { }, "jsonp").always(function (resp) { var countryCode = (resp && resp.country) ? resp.country : ""; callback(countryCode); }); }, utilsScript: domain + "/js/common/utils.js" }); telPhoneInput.css('width', '100%'); telPhoneInput.css('padding-left', '10px'); jQuery('.flag-container').css('display', 'none'); jQuery('.intl-tel-input').css('display', 'inline-block');}var brandresultName, nationalitiesList;function getBrandsAndNationalitesForBanner() { var Brandurl = domain + '/data/brand.json'; jQuery.getJSON(Brandurl, function (data) { brandresultName = new Array(); data.sort(function (a, b) { if (a.name < b.name) return -1; if (a.name > b.name) return 1; return 0; }); for (var i in data) { if (data[i].type && data[i].type == 'bank') { brandresultName.push(data[i].name); } } }); var nationalityUrl = domain + '/data/nationalities.json'; jQuery.getJSON(nationalityUrl, function (data) { nationalitiesList = data; });}jQuery(document).ready(function () { var x = document.URL; var prefix_banner = "Get a"; var suffix_banner = "Credit Card"; var carInsuranceBanner = '
\\\\
'; category = x.split("/")[4]; if (x.match(/credit-card/i)) { prefix_banner = "Get a"; suffix_banner = "Credit Card"; } if (x.match(/personal-loan/i) || x.match(/personal/i)) { prefix_banner = "Assured"; suffix_banner = "Loans"; } if (x.match(/top-10-personal-loans-can-consider-uae/)) { jQuery(personalLoanLeadsTemplate).insertAfter('.td-post-sharing.td-post-sharing-top'); jQuery('.td-post-content > .td-post-featured-image').css('display', 'none'); } if (x.match(/credit-card/i) || x.match(/personal-loan/i) || x.match(/personal/i)) { apiCallForBanner(x); inilizeTelInput(); getBrandsAndNationalitesForBanner(); checkedUrl = x.split("/")[3] + "/" + x.split("/")[4]; jQuery('.bannerSalaryDd').removeClass('select2-hidden-accessible') jQuery('.salaryPhoneDiv').find('span.select2-container').css('display', 'none'); jQuery('.modal-header').find('span.select2-container').css('display', 'none'); jQuery('#phonecallnowModal').click(function () { jQuery('#myModalForm').modal('show'); jQuery('.modal-backdrop').css('position', 'relative'); }); }setTimeout(function(){if (!jQuery('#formModal').length > 0) { jQuery('body').prepend(formModal);}}, 5000);});function countChar(val) { var len = val.value.length; if (len >= 7) { val.value = val.value.substring(0, 7); } else { jQuery('#mobileno').text(7 - len); }};var formModal = `
Thank you for providing your details.
Provide the following details to get a quick response
Get a Call
I don't want to share further details
`;function showHidePreferredTimeSelect() { jQuery('.preferred-time-select-div').toggle();}var allCards = [];function allotCardToUser(bannerData, isModalClose) { if (bannerData.monthlyIncome >= 8000 && bannerData.isOpted.opted && bannerData.requestFor === 'Credit Card') { var salary = bannerData.monthlyIncome; //get all suitable cards which have less minSal than user salary var suitableCards = allCards.filter(function (val) { return salary >= val.minSal; }) //find cards with same salary in suitable cards var multipleCards = suitableCards.filter(function (val) { return val.minSal === 8000 && salary >= 8000 && salary < 12000; }) //add data to bannerData if "call now" or "I don't want to share further details" is clicked //this is to save data to db while opening modal if (isModalClose) { bannerData.allotedCard = { provider: bannerData.isOpted.provider, card: jQuery('.suitable-cards').val() } } else { //show cards after modal is opened and add data to bannerData jQuery('.suitable-cards').html('') var suggestedCard = suitableCards[suitableCards.length - 1]; jQuery('.suitable-cards').append('
'); jQuery('.suitable-cards').val(suggestedCard.productName) for (i = suitableCards.length - 2; i >= 0; i--) { jQuery('.suitable-cards').append('
'); } bannerData.allotedCard = { provider: bannerData.isOpted.provider, card: jQuery('.suitable-cards').val() } } } else { jQuery('.suitable-cards-div').css('display', 'none'); } return bannerData;}function assignCards(category) { jQuery.getJSON(domain + '/data/leadFormConfig.json', function (data) { console.log(category) if (category === 'Credit Card') { allCards = data['uae'].cards['citi']; } });}var topBar = `
`;if(location.href !== domain + "/financial-blog/" && location.href.indexOf('category')===-1){jQuery('.td-header-style-5').prepend(topBar);window.onscroll = function() {renderScollWidth()};}function renderScollWidth() { var winScroll = document.body.scrollTop || document.documentElement.scrollTop; var height = document.documentElement.scrollHeight - document.documentElement.clientHeight; var scrolled = (winScroll / height) * 100; document.getElementById("myBar").style.width = scrolled + "%";}
As an expert in web development and online forms, I can analyze the provided JavaScript code to help you understand its functionality and purpose. The code appears to be part of a web page that involves capturing user details, especially for credit card applications, and interacting with the server through AJAX calls. Let me break down the key concepts used in this code:
-
AJAX Calls:
- The
page.apiCall
function is defined for making AJAX calls to the server. - The code uses jQuery's
ajax
method to handle asynchronous requests and responses.
- The
-
Form Handling:
- The script manipulates form elements dynamically based on user interactions.
- It validates user input for fields like name, mobile number, email, and monthly income.
- There is logic for setting the preferred country in a telephone input field.
-
Credit Card Application Process:
- The code appears to be designed for capturing user details for credit card applications.
- It calculates and suggests suitable credit cards based on the user's monthly income.
-
User Interface Interactions:
- The script includes logic for showing/hiding elements based on user actions, such as displaying a modal form.
- The script dynamically updates the UI with information retrieved from the server.
-
Event Tracking:
- The code uses Google Analytics (
ga
) for tracking user events, such as clicks on credit card banners. - Events are tracked based on different categories like "Credit Card," "Lead Banner Click," etc.
- The code uses Google Analytics (
-
Country-Specific Data Retrieval:
- The script fetches data (brand names and nationalities) from JSON files to populate dropdowns dynamically.
- It uses the domain variable to construct URLs for fetching data.
-
Telephone Input Handling:
- The script uses the
intlTelInput
library to handle international telephone number inputs. - It dynamically sets the country code and formats the phone number.
- The script uses the
-
Dynamic Content Rendering:
- The script dynamically renders content on the page based on user actions and server responses.
- It updates the UI with messages, banners, and suggested credit cards.
-
Error Handling:
- The script includes error handling for AJAX requests, ensuring that appropriate messages are displayed to the user.
-
Modal Windows:
- Modal windows are used for displaying additional information or capturing user details.
- The script manages the opening and closing of these modal windows.
-
Responsive Design:
- The code includes some logic related to responsive design, such as adjusting the display of elements on scroll.
Please note that the specific functionality and purpose of certain parts of the code may depend on external libraries or server-side implementations, which are not provided here. If you have any specific questions or if there's a particular aspect you'd like more clarification on, feel free to ask.