Loading...`; let formData = new FormData(); formData.append('dc_id', featureDCId); formData.append('header_type', 'html'); formData.append('request_type', 'POST'); formData.append('currentPage', currentPage); formData.append('dataType', dataType); formData.append('queryString', queryString); formData.append('profId', profId); formData.append('servId', JSON.stringify(servId)); formData.append('countryId', countryId); formData.append('stateId', stateId); formData.append('cityId', cityId); formData.append('levId', levId); formData.append('profsPost', JSON.stringify(profs)); formData.append('widget_name', 'Add-On - Bootstrap Theme - Search - Lazy Loader'); let myInit = { method: 'POST', body: formData }; fetch(url, myInit) .then(function (response) { return response.text(); }).then(function (html) { let parser = new DOMParser(); // Parse the text let result = parser.parseFromString(html, "text/html"); let newResultsHTML = result.getElementById('grabHTML__js').innerHTML; if (typeof viewIcons !== 'undefined') { newResultsHTML = newResultsHTML.replaceAll("grid_element", "grid_element hide"); } let amountOfClicks = result.getElementById('grabHTML__js').dataset.pages; if (typeof btnPositionOutside !== "undefined" && btnPositionOutside !== null) { $('.grid-container').append(newResultsHTML); } if (typeof btnPositionInside !== "undefined" && btnPositionInside !== null || btnPositionOutside === null && dataType == 13) { $('.clickToLoadMoreContainer').before(newResultsHTML); } setAmountPages(currentBTN, amountOfClicks); currentBTN.innerHTML = currentHTML; // default html currentBTN.classList.remove('loadingMore'); if (typeof viewIcons !== 'undefined') { setTimeout(function () { listView.click(); gridView.click(); $(".grid_element.hide").removeClass("hide"); $('.grid-container').masonry({ // options itemSelector: '.search_result', columnWidth: '.search_result' }); }, 800) } if (typeof favoriteOn == 'function') { favoriteOn(); } if (typeof runRoyalSlider == 'function') { runRoyalSlider(); } }).catch((error) => { console.error('Error:', error); }); }); } if (typeof gridView !== "undefined") { gridView.addEventListener('click', function () { gridView.classList.add('activeView'); if (gridView.classList.contains('activeView')) { btnClickMoreContainer.classList.add('gridBtnLazyLoad'); } else { btnClickMoreContainer.classList.remove('gridBtnLazyLoad'); } }); } if (typeof listView !== "undefined") { listView.addEventListener('click', function () { listView.classList.add('activeView'); if (listView.classList.contains('activeView')) { btnClickMoreContainer.classList.remove('gridBtnLazyLoad'); } else { btnClickMoreContainer.classList.add('gridBtnLazyLoad'); } }); } function setAmountPages(btn, amount) { if (!("pages" in btn.dataset)) { btn.dataset.pages = parseInt(amount) - 1; // we do -1 because the just clicked } else { btn.dataset.pages = parseInt(btn.dataset.pages) - 1; } if (btn.dataset.pages <= 0) { btn.remove(); } } ` + phonehtml + ` View Listing ` + `