//Script which calls WidgetContent.ashx to load content based upon URL parameters // Workflow: EmbeddedScript > WidgetJS.ashx > load advanced script (lead_content.js) > WidgetContent.ashx > WidgetMethods (optional) window.addEventListener("load", function () {//Page and images are fully loaded auPxJMPneXl(); }); function auPxJMPneXl() { if (!window.jQuery) { auPxJMPneXl("https://resources.ratesight.com/vendor/jquery/v3.5.1/dist/jquery.min.js", function () { bLYS835Q1ns(); }); function auPxJMPneXl(url, callback) { var jquery_script = document.createElement("script"); jquery_script.type = "text/javascript"; if (jquery_script.readyState) { jquery_script.onreadystatechange = function () { if (jquery_script.readyState == "loaded" || jquery_script.readyState == "complete") { jquery_script.onreadystatechange = null; callback(); } } } else { jquery_script.onload = function () { callback(); } } jquery_script.src = url; document.getElementsByTagName("head")[0].appendChild(jquery_script); //console.log("Loaded jQuery 3.5.1"); } } else { bLYS835Q1ns(); } } function LoadFormRatesightBootstrap() { if (!window.bootstrap) { LoadFormBootstrap("https://resources.ratesight.com/vendor/bootstrap/v5.3.0/js/bootstrap.bundle.min.js", function () { }); function LoadFormBootstrap(url, callback) { var bootstrap_script = document.createElement("script"); bootstrap_script.type = "text/javascript"; if (bootstrap_script.readyState) { bootstrap_script.onreadystatechange = function () { if (bootstrap_script.readyState == "loaded" || bootstrap_script.readyState == "complete") { bootstrap_script.onreadystatechange = null; callback(); } } } else { bootstrap_script.onload = function () { callback(); } } bootstrap_script.src = url; document.getElementsByTagName("head")[0].appendChild(bootstrap_script); console.log("Loaded Bootstrap"); } } } function bLYS835Q1ns() { jQuery(document).ready(function () { //const url = window.location.search; //let urlParameters = new URLSearchParams(url); const OPTION_TYPE = 1; const OFFICE_ID = 140531; const FORM_ID = 70117; GetRatesightFormContent(OPTION_TYPE, OFFICE_ID, FORM_ID); }); } async function GetRatesightFormContent(typ, oid, fid) { const scriptId = 'rsForm-' + fid; let targetUrl = 'https://app.ratesight.com/Widgets/WidgetContent.ashx?typ=' + typ + '&oid=' + oid + '&fid=' + fid; if (window.location.href.includes('localhost')) { targetUrl = 'http://localhost:60574/Widgets/WidgetContent.ashx?typ=' + typ + '&oid=' + oid + '&fid=' + fid; } jQuery.ajax({ type: 'GET', url: targetUrl, success: onSuccess, error: onFailure }); function onSuccess(result) { let scriptElement = document.getElementById(scriptId); jQuery(scriptElement).after(result); //document.body.appendChild(modalDiv); //let contentDiv = document.createElement('div'); //contentDiv.id = 'rsLeadForm'; //contentDiv.innerHTML = result; //jQuery(result).appendTo('body'); //jQuery('body').append(contentDiv); } function onFailure(error) { console.log('Error!!' + error.log); } }