function gradient(id, level) {
var box = document.getElementById(id);
box.style.opacity = level;
box.style.MozOpacity = level;
box.style.KhtmlOpacity = level;
box.style.filter = "alpha(opacity=" + level * 100 + ")";
box.style.display = "block";
return;
}
function fadein(id) {
var level = 0;
while (level <= 1) {
setTimeout("gradient('" + id + "'," + level + ")", (level * 300) + 10);
level += 0.01;
}
}
// Open the lightbox
function openbox(formtitle, fadin, boxname) {
document.getElementById("log_in_dropdown").style.display = "none";
var box = document.getElementById(boxname);
document.getElementById('filter').style.display = 'block';
var btitle = document.getElementById('boxtitle');
btitle.innerHTML = formtitle;
if (fadin) {
gradient(boxname, 0);
fadein(boxname);
} else {
box.style.display = 'block';
}
}
// Close the lightbox
function closebox(boxname) {
document.getElementById(boxname).style.display = 'none';
document.getElementById('filter').style.display = 'none';
}
function openHomePage(type, obj) {
var jqr = jQuery.noConflict();
if (type == "browse") {
jqr("#browseArea").css('display', 'block');
jqr("#dv_home_dynamic").css('display', 'none');
jqr('.dv_home_rt_2 div').removeClass();
jqr(obj).addClass('dv_nav_active');
} else {
jqr("#dv_home_dynamic").css('display', 'block');
jqr("#browseArea").css('display', 'none');
jqr("#dv_home_dynamic").html("");
jqr("#loadingIcon").css('display', 'block');
jqr('.dv_home_rt_2 div').removeClass();
jqr(obj).addClass('dv_nav_active');
url = jqr("#site_url").val();
var loadUrl = url + "/action.php?type=" + type;
// alert(loadUrl);
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"type": type},
success: function (data) {
jqr("#loadingIcon").css('display', 'none');
jqr("#dv_home_dynamic").html(data);
},
error: function (data) {
jqr("#loadingIcon").css('display', 'none');
}
});
}
}
function openRegistrationPanel(div, id) {
var jqr = jQuery.noConflict();
if(div == "rgspanel1"){
jqr(".rgsdv1").css('display','block');
} else{
jqr(".rgsdv1").css('display','none');
}
jqr(".rgspanel").css('display', 'none');
jqr("#" + div).css('display', 'block');
jqr(".editmenu").removeClass("rgsactive");
jqr("#" + id).addClass("rgsactive");
jqr([document.documentElement, document.body]).animate({
scrollTop: jqr("#" + id).offset().top
}, 250);
}
function confirmChange1(div,id){
var jqr = jQuery.noConflict();
jqr(".ques_on_select").css('display','block');
}
function openPFPage(type, obj, userid) {
var jqr = jQuery.noConflict();
jqr("#dv_home_dynamic").html("");
if (type == "about") {
jqr("#dv_pf_fix").css('display', 'block');
jqr("#dv_pf_dynamic").html("");
jqr('.dv_home_rt_2 div').removeClass();
jqr(obj).addClass('dv_nav_active');
} else {
jqr("#dv_pf_fix").css('display', 'none');
jqr("#loadingIcon").css('display', 'block');
jqr('.dv_home_rt_2 div').removeClass();
jqr(obj).addClass('dv_nav_active');
url = jqr("#site_url").val();
var loadUrl = url + "/action.php?type=" + type + '&user_id=' + userid;
//alert(loadUrl);
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"type": type},
success: function (data) {
jqr("#loadingIcon").css('display', 'none');
jqr("#dv_pf_dynamic").html(data);
},
error: function (data) {
jqr("#loadingIcon").css('display', 'none');
}
});
}
}
function openUrl(url) {
window.location.href = url;
}
function blockMe(user_id, isblock, reloadme) {
var jqr = jQuery.noConflict();
url = jqr("#site_url").val();
var loadUrl = url + '/action.php';
//alert(loadUrl);
var data = 'type=blockUser&user_id=' + user_id + '&isblock=' + isblock
// alert(loadUrl+'type=blockUser&user_id='+user_id+'&isblock='+isblock);
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"type": "blockUser", "user_id": user_id, "isblock": isblock},
success: function (data) {
if (reloadme == 'yes') {
window.location.reload();
} else {
if (isblock == "yes") {
alert('User has been blocked');
} else {
alert('User has been unblocked');
}
}
},
error: function (data) {
jqr("#loadingIcon").css('display', 'none');
}
});
}
function displayAlert(msg) {
alert(msg);
}
function updateOther(txtvalue, id) {
var jqr = jQuery.noConflict();
jqr("#" + id).val(txtvalue);
}
function delMe(id) {
var jqr = jQuery.noConflict();
jqr("#menurow" + id).remove();
}
function delMeRight(id) {
var jqr = jQuery.noConflict();
jqr("#menurowright" + id).remove();
}
function addMore() {
var jqr = jQuery.noConflict();
nextrow = parseInt(jqr('#lastrow').val()) + 1;
var html = "
";
jqr("#addBeforeMe").before(html);
jqr('#lastrow').val(nextrow);
}
var jqr = jQuery.noConflict();
document.addEventListener('click', function (event) {
if (event.target.matches('.menu_right')) {
jqr(".fadermenu").slideUp();
jqr("#fadermenu").slideToggle();
} else if (event.target.matches('.menu_left')) {
jqr(".fadermenu").slideUp();
jqr("#fadermenuleft").slideToggle();
} else if (event.target.matches('.menubottom')) {
jqr(".fadermenu").slideUp();
jqr("#fadermenubottom").slideToggle();
} else if (event.target.matches('.menumail')) {
jqr(".fadermenu").slideUp();
jqr("#fadermenumail").slideToggle();
} else if (event.target.matches('.menuprofile')) {
jqr(".fadermenu").slideUp();
jqr("#fadermenuprofile").slideToggle();
} else if (event.target.matches('.menuupgrade')) {
jqr(".fadermenu").slideUp();
jqr("#fadermenuupgrade").slideToggle();
} else if (event.target.matches('.menueditprofile')) {
jqr(".fadermenu").slideUp();
jqr("#fadermenueditprofile").slideToggle();
} else if (event.target.matches('.browse_menu')) {
jqr(".fadermenu").slideUp();
jqr("#fadermenubrowse").slideToggle();
} else {
jqr(".fadermenu").slideUp();
return;
}
// Don't follow the link
event.preventDefault();
}, false);
function closePrefPopup() {
jqr("#fadermenubrowse").slideUp();
}
function submitPagination(page, size) {
jqr('#page').val(page);
jqr('#shownum').val(size);
showMoreResult();
//jqr('#search_pager_myForm').submit();
}
function submitPaginationForm() {
jqr("#shownum").val(jqr("#lstShownum").val());
jqr('#search_pager_myForm').submit();
}
function addMoreRight() {
var jqr = jQuery.noConflict();
nextrow = parseInt(jqr('#lastrowRight').val()) + 1;
var html = "";
jqr("#addBeforeMeRight").before(html);
jqr('#lastrowRight').val(nextrow);
}
function closeCommentBox(box) {
jqr('#' + box).css({'display': 'none'});
}
function openGiftBox() {
jqr('#QuickBoxGifts').css({'display': 'block'});
}
function selectGift(img, thisobj) {
jqr('.dv_gft').children('div').removeClass('selectme');
jqr(thisobj).children('div').addClass('selectme');
jqr('#giftId').val(img);
}
function sendGift() {
url = jqr("#site_url").val();
var loadUrl = url + "/action.php?type=gift&action=send";
if (jqr('#giftId').val()) {
jqr("#loading_img").css('display', 'block');
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"gift": jqr('#giftId').val(), "toUserId": jqr('#toUserId').val(), "credits": jqr('#credits').val()} ,
success: function (data) {
jqr("#loading_img").css('display', 'none');
alert("Gift sent successfully");
jqr('#QuickBoxGifts').css({'display': 'none'});
},
error: function (data) {
alert(data.responseText);
jqr("#loading_img").css('display', 'none');
}
});
} else {
alert('Please select a gift first.');
}
}
function delGift(id, page) {
url = jqr("#site_url").val();
var loadUrl = url + "/action.php?type=delGift";
//alert(loadUrl+'&id='+id);
if (confirm('Are you sure to delete?')) {
jqr("#loadingIcon").css('display', 'block');
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"id": id},
success: function (data) {
jqr("#loadingIcon").css('display', 'none');
if (page == 'home') {
openHomePage('gifts', this);
} else {
window.location.reload();
}
},
error: function (data) {
alert("Please try again.");
jqr("#loadingIcon").css('display', 'none');
}
});
}
}
function openRequest() {
jqr('#reqFrm').submit();
}
function displayNextPrf(cID, nID) {
jqr("#prfProfile" + cID).remove();
jqr("#prfProfile" + nID).css('display', 'block');
}
function saveInst(uid, cID, nID, interest) {
url = jqr("#site_url").val();
var loadUrl = url + "/action.php?type=saveInterest";
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"id": uid, "interest": interest},
success: function (data) {
jqr("#prfProfile" + cID).remove();
jqr("#prfProfile" + nID).css('display', 'block');
},
error: function (data) {
alert("Please try again.");
jqr("#loadingIcon").css('display', 'none');
}
});
}
function changeSearchView(varclass, act) {
jqr(".searchView").css('display', 'none');
jqr("." + varclass).css('display', 'block');
jqr(".schview").removeClass('activeview');
jqr('.' + act).addClass('activeview');
if (varclass == "listview") {
jqr('#lstResultAs').val('list');
} else {
jqr('#lstResultAs').val('gallery');
}
}
function processFunction(action, touser, touserId) {
url = jqr("#site_url").val();
userId = jqr("#currentUserId").val();
if (action == "message") {
window.location.href = url + '/send-mail/' + userId + '/' + touser;
} else if (action == "addFriend") {
addFriend(url, touserId);
refreshDD('select_search_res_div', touserId);
} else if (action == "addToFavorite") {
fetch('hot-list/' + touserId + '/' + touser)
.then(response => {
if (response.status === 200) {
return response.text().then(data => {
alert('Profile was added to Favorites'); // Success message
});
} else {
alert('Could not add user to your favorites.'); // Handle other status codes
}
})
.catch(error => {
alert('An error occurred: ' + error.message); // Network error handling
});
} else if (action == "sendFlirt") {
window.location.href = url + '/send-flirt/' + userId + '/' + touser;
} else if (action == "sendGift") {
jqr('#toUserId').val(touserId);
openGiftBox();
} else if (action == "report") {
reportUser(touserId);
} else if (action == "block") {
blockMe(touserId, 'yes', 'no');
refreshDD('select_search_res_div', touserId);
} else if (action == "removeFriend") {
removeFriend(url, touserId);
refreshDD('select_search_res_div', touserId);
} else if (action == "unblock") {
blockMe(touserId, 'no', 'no');
refreshDD('select_search_res_div', touserId);
}
}
function refreshDD(id, userid) {
var loadUrl = url + "/action.php";
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"user_id": userid, "type": "refreshDD"},
success: function (data) {
jqr("#" + id + userid).html(data);
},
error: function (data) {
//alert("Please try again.");
}
});
}
function addFriend(url, user_id) {
var loadUrl = url + "/action.php";
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"user_id": user_id, "type": "addFriend"},
success: function (data) {
alert(data);
},
error: function (data) {
alert("Please try again.");
}
});
}
function removeFriend(url, user_id) {
var loadUrl = url + "/action.php";
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"user_id": user_id, "type": "removeFriend"},
success: function (data) {
alert(data);
},
error: function (data) {
alert("Please try again.");
}
});
}
jqr(document).ready(function ($) {
jqr(".search_result").mouseover(function () {
meid = jqr(this).attr('id');
jqr("#more" + meid).css('display', 'block');
});
jqr(".search_result").mouseout(function () {
meid = jqr(this).attr('id');
jqr("#more" + meid).css('display', 'none');
});
});
function viewGiftBox(touserId) {
jqr('#toUserId').val(touserId);
openGiftBox();
}
function checkAllOpt(cls) {
jqr('.chk-' + cls).prop('checked', true);
}
function uncheckkAllOpt(cls) {
jqr('.chk-' + cls).prop('checked', false);
}
function showMoreResult() {
url = jqr("#site_url").val();
var loadUrl = url + "/prgsearchpagination.php";
jqr("#loading_simg").css('display', 'inline');
jqr.ajax({
url: loadUrl,
method: 'POST',
data: jq('#search_pager_myForm').serialize(),
success: function (data) {
jqr(".searchpagination").remove();
// alert(data);
jqr(".searchresult").append(data);
scroll = jqr("#scroll").val() + 800;
jqr("#scroll").val(scroll);
jqr("#loading_simg").css('display', 'none');
jqr(".searchresult").scrollTop(scroll);
},
error: function (data) {
jqr("#loading_simg").css('display', 'none');
alert("Please try again.");
}
});
}
function displayMembership(divid) {
jqr(".dvupfull").css('display', 'none');
jqr(".dvuptoggleme").removeClass("dvuptogglactive");
jqr("#toggle" + divid).addClass("dvuptogglactive");
jqr("#div" + divid).css('display', 'block');
}
function saveExpDate(uid) {
url = jqr("#site_url").val();
var loadUrl = url + "/action.php";
var date = jqr("#dd_year" + uid).val() + '-' + jqr("#dd_month" + uid).val() + '-' + jqr("#dd_day" + uid).val();
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"user_id": uid, "type": "updateExpDate", "date": date},
success: function (data) {
},
error: function (data) {
}
});
}
function changePwd(uid) {
jqr("#pwd" + uid).val("");
jqr("#pwd" + uid).prop('disabled', false);
jqr("#change" + uid).css('display', 'none');
jqr("#savepwd" + uid).css('display', 'block');
}
function updatePwd(uid) {
url = jqr("#site_url").val();
var loadUrl = url + "/action.php";
var pwd = jqr("#pwd" + uid).val();
if (pwd != "") {
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"user_id": uid, "type": "updatePwd", "pwd": pwd},
success: function (data) {
jqr("#pwd" + uid).val(data);
jqr("#pwd" + uid).prop('disabled', true);
jqr("#change" + uid).css('display', 'block');
jqr("#savepwd" + uid).css('display', 'none');
},
error: function (data) {
}
});
}
}
function markFeature(uid) {
url = jqr("#site_url").val();
var loadUrl = url + "/action.php";
var pwd = jqr().val();
if (!jqr("#feature" + uid).is(':checked')) {
var feature = 0;
} else {
var feature = 1;
}
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"user_id": uid, "type": "markFeature", "feature": feature},
success: function (data) {
},
error: function (data) {
}
});
}
function checkme() {
if (!jqr('#checkAll').is(':checked')) {
jqr('.chk_user_id').prop('checked', false);
} else {
jqr('.chk_user_id').prop('checked', true);
}
}
function openFeature() {
var ele = jqr('#fa_featured');
if (ele.hasClass('fa-plus')) {
ele.removeClass('fa-plus')
.addClass('fa-minus')
} else {
ele.addClass('fa-plus')
.removeClass('fa-minus')
}
jqr("#dv_featured_inner").slideToggle();
}
function readMore(id) {
jq("#moreText" + id).slideToggle(100, "linear");
jq('#moreText' + id).css('display', 'contents');
jq('#readMore' + id).css('display', 'none');
jq('#readLess' + id).css('display', 'contents');
}
function readLess(id) {
jq("#moreText" + id).slideToggle(50, "linear");
jq('#readMore' + id).css('display', 'contents');
jq('#readLess' + id).css('display', 'none');
}
function sendInstMessage(bmsg) {
url = jqr("#site_url").val();
var loadUrl = url + "/action.php?type=sendInstantMsg";
if (jqr(".inst_txt").val() != "") {
jqr("#instmsgres").html("");
jqr.ajax({
url: loadUrl,
method: 'POST',
data: jqr('#frminstmsg').serialize(),
success: function (data) {
jqr("#loadingIcon").css('display', 'none');
var json = jq.parseJSON(data);
//now json variable contains data in json format
//let's display a few items
for (var i = 0; i < json.length; ++i) {
var result = json[i].result;
var message = json[i].msg;
}
if (result == "success") {
jqr(".inst_txt").val("");
}
jqr("#instmsgres").html(message);
},
error: function (data) {
jqr("#loadingIcon").css('display', 'none');
}
});
} else {
jqr(".inst_txt").focus();
jqr("#instmsgres").html(bmsg);
}
}
function openKYCBox() {
jqr('#KYCBox').css({'display': 'block'});
}
function changeUserType(uid, userType) {
url = jqr("#site_url").val();
var loadUrl = url + "/action.php";
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"user_id": uid, "type": "userType", "user_type": userType},
success: function (data) {
},
error: function (data) {
}
});
}
function startPersQuize()
{
jqr("#quizeinnerperson").html("");
jqr("#quizeinner").html("");
jqr("#quizeInnerHeader").css('display', 'block');
jqr('#PersonalityBoxQuize').css({'display': 'block'});
url = jqr("#siteUrl").val();
var loadUrl = url + "/action.php?type=getPersonalityQues";
jqr.ajax({
url: loadUrl,
method: 'GET',
success: function (data)
{
jqr("#loadingIcon").css('display', 'none');
jqr("#quizeInnerHeader").css('display', 'none');
jqr("#quizeinnerperson").html(data);
},
error: function (data)
{
jqr("#loadingIcon").css('display', 'none');
}
});
}
function nextPersonQuize(qID, currentQID, final) {
if (currentQID == 0) {
jqr(".quizQues").css('display', 'none');
jqr("#quizQues" + qID).css('display', 'block');
} else {
var url = jqr("#siteUrl").val();
jqr('#PersonalityBoxQuize').css({'display': 'block'});
var loadUrl = url + "/action.php?type=savePersonQuiz";
jqr.ajax({
url: loadUrl,
method: 'GET',
data: jqr('#frmQuiz' + currentQID).serialize(),
success: function(data) {
if (data === "success") {
if (!final) {
updatePersonQuizProgress();
jqr("#loadingIcon").css('display', 'none');
jqr(".quizQues").css('display', 'none');
jqr("#quizQues" + qID).css('display', 'block');
} else {
jqr("#PersonalityBoxQuize").css('display', 'none');
jqr("#quizeinnerperson").html("");
var sumOfQuiz = calculateSumOfDataIds();
if (confirm("You have completed the quiz successfully! We would also like you to complete the 'Compatibility Quiz' to help our algorithm find people with higher compatibility.")) {
startQuize();
}
}
// window.location.href = url;
} else {
alert(data);
}
},
error: function(data) {
jqr("#loadingIcon").css('display', 'none');
}
});
}
}
function prevPersonQuize(qID)
{
jqr(".quizQues").css('display', 'none');
jqr("#quizQues"+qID).css('display', 'block');
}
function startQuize() {
jqr("#quizeinner").html("");
jqr("#quizeinnerperson").html("");
jqr("#quizeInnerHeader").css('display', 'block');
jqr('#QuickBoxQuize').css({'display': 'block'});
url = jqr("#siteUrl").val();
jqr('#QuickBoxQuize').css({'display': 'block'});
//alert(jqr('#frmQuize').serialize());
var loadUrl = url + "/action.php?type=getQuizeQues";
//alert(loadUrl);
jqr.ajax({
url: loadUrl,
method: 'GET',
success: function (data) {
jqr("#loadingIcon").css('display', 'none');
jqr("#quizeInnerHeader").css('display', 'none');
jqr("#quizeinner").html(data);
},
error: function (data) {
jqr("#loadingIcon").css('display', 'none');
}
});
}
function nextQuize(qID, currentQID, final) {
if (currentQID == 0) {
jqr(".quizQues").css('display', 'none');
jqr("#quizQues" + qID).css('display', 'block');
} else {
var url = jqr("#siteUrl").val();
jqr('#QuickBoxQuize').css({'display': 'block'});
var loadUrl = url + "/action.php?type=saveQuiz";
jqr.ajax({
url: loadUrl,
method: 'GET',
data: jqr('#frmQuiz' + currentQID).serialize(),
success: function(data) {
if (data === "success") {
if (!final) {
updateQuizProgress();
jqr("#loadingIcon").css('display', 'none');
jqr(".quizQues").css('display', 'none');
jqr("#quizQues" + qID).css('display', 'block');
} else {
jqr("#QuickBoxQuize").css('display', 'none');
jqr("#quizeinner").html("");
var sumOfQuiz = calculateSumOfDataIds();
if (confirm("You have completed the quiz successfully! We would also like you to complete the 'Personality Quiz' to help our algorithm find people with higher compatibility.")) {
startPersQuize();
}
}
} else {
alert(data);
}
},
error: function(data) {
jqr("#loadingIcon").css('display', 'none');
}
});
}
}
function calculateSumOfDataIds() {
var selectedOptions = jqr('input[type="checkbox"]:checked[data-id]');
var sum = 0;
selectedOptions.each(function() {
sum += parseInt(jqr(this).attr('data-id'));
});
return sum;
}
function updatePersonQuizProgress()
{
url = jqr("#siteUrl").val();
var loadUrl = url + "/action.php?type=getPersonQuizProgress";
//alert(loadUrl);
jqr.ajax({
url: loadUrl,
method: 'GET',
success: function (data)
{
//alert(data);
jqr("#prf_progress_p").css("width",data+'%');
jqr("#quizSpan").html(data+'%');
},
error: function (data)
{
}
});
}
function updateQuizProgress() {
url = jqr("#siteUrl").val();
var loadUrl = url + "/action.php?type=getQuizProgress";
//alert(loadUrl);
jqr.ajax({
url: loadUrl,
method: 'GET',
success: function (data) {
//alert(data);
jqr("#prf_progress_p").css("width", data + '%');
jqr("#quizSpan").html(data + '%');
},
error: function (data) {
}
});
}
function reportUser(userId) {
jqr("#loadingIcon").css('display', 'block');
url = jqr("#site_url").val();
var loadUrl = url + "/action.php";
// alert(loadUrl);
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"type": "reportUser", "user_id": userId},
success: function (data) {
alert("Reported successfully!");
jqr("#loadingIcon").css('display', 'none');
jqr("#report-user-button-" + userId)
.addClass('disabledbutton')
.attr('disabled', 'disabled')
.attr('onclick', null)
.attr('value', 'reported');
},
error: function (data) {
jqr("#loadingIcon").css('display', 'none');
}
});
}
function saveCaption(field) {
// jqr("#loadingIcon").css('display', 'block');
url = jqr("#site_url").val();
var caption = jqr("#cpt_" + field).val();
if (caption != "") {
var loadUrl = url + "/action.php";
jqr.ajax({
url: loadUrl,
method: 'POST',
data: {"type": "updateCaption", "field": field, "caption": caption},
success: function (data) {
alert("Tool-tip updated successfully!");
//jqr("#loadingIcon").css('display', 'none');
},
error: function (data) {
//jqr("#loadingIcon").css('display', 'none');
}
});
} else {
jqr("#cpt_" + field).focus();
alert("Please enter tooltip!!");
}
}
function prevQuize(qID) {
jqr(".quizQues").css('display', 'none');
jqr("#quizQues" + qID).css('display', 'block');
}
function validateEditProfile() {
validation = true;
/* for panel one*/
jqr(".rsrequired").each(function (item) {
if (jqr(this).val() == "") {
alert(jqr(this).attr('title') + ' is mandatory!');
validation = false;
jqr(this).focus();
return false;
}
});
if (!validation) {
return false;
}
/* for panel two*/
jqr(".rsrequiredpanel2").each(function (item) {
if (jqr(this).val() == "") {
alert(jqr(this).attr('title') + ' is mandatory!');
validation = false;
jqr(this).focus();
return false;
}
});
if (!validation) {
return false;
}
/***************************/
/* for panel three*/
jqr(".rsrequiredpanel3").each(function (item) {
if (jqr(this).val() == "") {
alert(jqr(this).attr('title') + ' is mandatory!');
validation = false;
jqr(this).focus();
return false;
}
});
/***************************/
if (jqr('.chkseeking:checkbox:checked').length == 0) {
validation = false;
alert("Please select seeking!");
jqr(".chkseeking").focus();
return false;
}
/*********************/
var totalMultiChkCount = jqr("#totalMultiChkCount").val();
for (var chkct = 1; chkct <= totalMultiChkCount; chkct++) {
if (jqr('.rsrequiredchkpanel' + chkct + ':checkbox:checked').length == 0) {
validation = false;
alert("Please check " + jqr('.rsrequiredchkpanel' + chkct).attr('title'));
jqr('.rsrequiredchkpanel' + chkct).focus();
return false;
}
}
/******************/
if (jqr("#txtComment").val().length < 20) {
alert("Please enter 20 character in About Me field!");
validation = false;
return false;
}
/********************/
if (!validation) {
return false;
} else {
return true
}
}
function submitKYC() {
url = jqr("#siteUrl").val();
var loadUrl = url + "/prgkycupload.php";
if (jqr('#kyc_address_proof').get(0).files.length === 0 ||
jqr('#kyc_id_proof').get(0).files.length === 0) {
jqr("#kyc_id_proof").focus();
alert("Please upload all files!!");
} else {
var formData = new FormData(jqr("#frmKyc")[0]);
if (jqr('#kyc_certificate_proof').length && jqr('#kyc_certificate_proof').get(0).files.length > 0) {
// The file is included if it exists and has been uploaded
formData.append('kyc_certificate_proof', jqr('#kyc_certificate_proof')[0].files[0]);
}
jqr.ajax({
url: loadUrl,
type: 'POST',
data: formData,
mimeType: "multipart/form-data",
contentType: false,
cache: false,
processData: false,
success: function (data, textStatus, jqXHR) {
//alert(data);
//console.log(data);
var json = jqr.parseJSON(data);
//now json variable contains data in json format
//let's display a few items
for (var i = 0; i < json.length; ++i) {
var result = json[i].result;
var message = json[i].msg;
}
if (result == "success") {
jqr("#kycpanel").html("");
jqr("#kycpanel").html('' + message + '
');
jqr("#kycpanel").css({'height': '300px'});
//
} else {
alert(message);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('error');
}
});
}
}
function combinedFunction(arg1, arg2) {
confirmChange1(arg1, arg2);
var questionid = arg2.replace('inputselectquestion_','');
confirmChange(questionid); // Call the second function
}
function editProfileCombinedFunction(arg1, arg2) {
confirmChange1(arg1, arg2);
var questionid = arg2.replace('inputselectquestion_','');
editProfileConfirmChange(questionid); // Call the second function
}
function editProfileConfirmChange(questionid){
console.log(questionid);
var dropDown = event.target;
var dataIdValue = dropDown.getAttribute("data-id");
var rId = jqr("#rId").val();
var dropDownValue = dropDown.options[dropDown.selectedIndex].text;
var xhr = new XMLHttpRequest();
console.log('vjsvkjsd');
xhr.open("POST", "register_ajax.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
// Handle the response by appending it to a specific element
var response = xhr.responseText;
}
};
xhr.send("confirmation=" + encodeURIComponent(dropDownValue) + "&rTypeId=" + encodeURIComponent(rId) + "&question_id=" + encodeURIComponent(questionid)+"&lastdivid="+encodeURIComponent(lastdivid)+"&totalsubquestion="+totalsubquestion);
}
window.addEventListener('beforeunload', function(event) {
// Clear form data
document.getElementById('FrmRegister').reset();
console.log("everything is done ");
});
window.addEventListener('beforeunload', function() {
sessionStorage.removeItem('FrmRegister');
});
function confirmChange(questionid) {
console.log('0');
var lastdivid = '0';
if(jqr('.questions:last').attr('id')) { lastdivid = jqr('.questions:last').attr('id'); }
var totalsubquestion = 0;
if(jqr('#totalsubquestion').val()) { totalsubquestion = jqr('#totalsubquestion').val(); }
var dropDown = event.target;
// Get the data-id attribute value
var dataIdValue = dropDown.getAttribute("data-id");
var rId = jqr("#rId").val();
// Get the selected option's text content
var dropDownValue = dropDown.options[dropDown.selectedIndex].text;
var xhr = new XMLHttpRequest();
console.log('vjsvkjsd');
xhr.open("POST", "register_ajax.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
// Handle the response by appending it to a specific element
var response = xhr.responseText;
var children = document.getElementById("slides").children;
for (var i = 0; i < children.length; i++) {
children[i].style.display = "none";
}
var targetElement = document.getElementById("slides");
if (targetElement) {
targetElement.innerHTML += response;
console.log(targetElement.innerHTML);
if(response.length > 2){
jqr('#mqslides').hide();
jqr('#mqslideButtons').hide();
jqr("#slides").show();
jqr("#subquestionbtn").show();
} else {
jqr('#mqslides').show();
jqr('#mqslideButtons').show();
jqr("#subquestionbtn").hide();
}
} else {
console.error("Target element not found.");
}
}
};
xhr.send("confirmation=" + encodeURIComponent(dropDownValue) + "&rTypeId=" + encodeURIComponent(rId) + "&question_id=" + encodeURIComponent(questionid)+"&lastdivid="+encodeURIComponent(lastdivid)+"&totalsubquestion="+totalsubquestion);
}
//Custom code for slide
// jqr(document).ready(function() {
// var slideW = '900';
// var qslideW = '900';
// var current = 0;
// var qcurrent = 0;
// jqr('.laststep').prop('disabled', true);
// jqr('#mqprev').hide();
// jqr(document).on('click','#prev',function(e) {
// if (current > 0 && current <= jqr('#slides').children().length - 1) {
// current--;
// }
// e.preventDefault();
// jqr('#slides').animate({
// scrollLeft: slideW * current
// }, 1000);
// });
// jqr(document).on('click','#next',function(e) {
// if (current < jqr('#slides').children().length - 1) {
// current++;
// }
// e.preventDefault();
// jqr('#slides').animate({
// scrollLeft: slideW * current
// }, 1000);
// });
// jqr(document).on('click','#mqprev',function(e) {
// var currentclass = 'mq_slide'+(qcurrent - 1);
// jqr(".mqquestions").removeClass('active');
// if((jqr('#mqslides').children().length - 1) < qcurrent){
// jqr('#mqnext').attr('type', 'submit');
// }
// if (qcurrent > 0 && qcurrent <= jqr('#mqslides').children().length - 1) {
// jqr("#"+currentclass).addClass('active');
// qcurrent--;
// }
// e.preventDefault();
// jqr('#mqslides').animate({
// scrollLeft: qslideW * qcurrent
// }, 1000);
// });
// jqr(document).on('click','#mqnext',function(e) {
// var currentclass = 'mq_slide'+(qcurrent + 1);
// jqr(".mqquestions").removeClass('active');
// //var checkdata = jqr(".active").find("input[type='text']").val();
// var inputField = jqr("#"+currentclass).find("input[type='text']");
// var checkdata = inputField.val();
// alert(checkdata);
// if (inputField.length > 0 && checkdata.trim() !== "" && checkdata != 'undefined') {
// jqr(".error-message").html("");
// } else {
// jqr(".error-message").html(jqr("#"+currentclass).find("input[type='text']").attr('title'));
// }
// var inputFieldpass = jqr("#"+currentclass).find("input[type='password']");
// var checkdatapass = inputFieldpass.val();
// if (inputFieldpass.length > 0 && checkdatapass.trim() !== "") {
// jqr(".error-message").html("");
// } else {
// jqr(".error-message").html(jqr("#"+currentclass).find("input[type='password']").attr('title'));
// }
// var inputFieldPass = jqr("#" + currentclass).find("input[type='password']");
// var inputFieldConfirm = jqr("#" + currentclass).find("input[type='password']");
// var passwordValue = inputFieldPass.val();
// var confirmValue = inputFieldConfirm.val();
// if (passwordValue !== "" && passwordValue === confirmValue) {
// jqr(".error-message").html("");
// } else {
// jqr(".error-message").html("Passwords do not match");
// }
// jqr('#mqprev').show();
// if((jqr('#mqslides').children().length - 1) == qcurrent){
// jqr('#mqnext').attr('type', 'submit');
// jqr('#mqnext').attr('id', '');
// jqr('#mqnext').html('Register');
// }
// if (qcurrent < jqr('#mqslides').children().length - 1) {
// jqr("#"+currentclass).addClass('active');
// qcurrent++;
// }
// e.preventDefault();
// jqr('#mqslides').animate({
// scrollLeft: qslideW * qcurrent
// }, 1000);
// });
// });
var subProfileArrData = {};
jqr(document).ready(function () {
jqr(document).on('keyup','.subprofile',function(){
var name = jqr(this).attr("name");
subProfileArrData[name] = jqr(this).val();
});
// Initial slide index
var currentSlide = 0;
const result = jqr(".mqquestions");
const length = (result.length - 1);
function isValidEmail(email) {
console.log('1' + email);
// Regular expression for a basic email format check
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
function validatePhoneNumber(phoneNumber) {
var numericPhoneNumber = phoneNumber.replace(/\D/g, '');
if (numericPhoneNumber.length === 10) {
return true;
} else {
return false;
}
}
// Function to navigate to the next slide
function nextSlide() {
currentSlide++;
console.log('currentSlide '+currentSlide);
showCurrentSlide();
}
function nextSlideQuiz() {
currentSlide++;
showCurrentSlideQuiz();
}
// Function to navigate to the previous slide
function prevSlide() {
currentSlide--;
showCurrentSlide();
}
function prevSlideQuiz() {
currentSlide--;
showCurrentSlideQuiz();
}
// Function to show the current slide and hide others
function showCurrentSlide() {
if(currentSlide == 0){
jqr("#mqprev").hide();
}
jqr(".mqquestions").hide();
jqr("#mq_slide" + currentSlide).show();
}
function showCurrentSlideQuiz() {
if(currentSlide == 0){
jqr("#mqprev").hide();
}
jqr(".mqquestions").hide();
jqr("#mq_slide" + currentSlide).show();
}
// Event handler for next button click
jqr("#mqnext").on("click", function () {
// Get the current slide container based on the current slide number
var currentSlideContainer = jqr("#mq_slide" + currentSlide);
// Check if all required fields in the current slide are filled
var isValid = true;
currentSlideContainer.find("input[required], select[required], textarea[required]").each(function() {
if (jqr(this).val() === '') {
isValid = false;
} else {
}
});
if (!isValid) {
alert("Please fill all required fields before proceeding to the next slide."); // Or show a custom message
return; // Stop the slide transition if there are unfilled required fields
}
jqr("#mqprev").show();
if(currentSlide === length){
jqr(this).attr('type', 'submit');
jqr(this).attr('id', '');
jqr(this).html('Register');
} else{
nextSlide();
}
if (currentSlide > 0) {
jqr("#mqprev").show();
} else {
jqr("#mqprev").hide();
}
});
jqr("#mqnextQuiz").on("click", function () {
// Get the current slide container based on the current slide number
var currentSlideContainer = jqr("#mq_slide" + currentSlide);
// Check if all required fields in the current slide are filled
var isValid = true;
currentSlideContainer.find("input[required], select[required], textarea[required]").each(function() {
if (jqr(this).val() === '') {
isValid = false;
jqr(this).addClass('error'); // Add error class to highlight the unfilled field
} else {
jqr(this).removeClass('error'); // Remove error class if the field is filled
}
});
if (!isValid) {
alert("Please fill all required fields before proceeding to the next slide."); // Or show a custom message
return; // Stop the slide transition if there are unfilled required fields
}
jqr("#mqprevQuiz").show();
jqr("#skipQuiz").show();
if (currentSlide == length) {
jqr(this).attr('type', 'submit');
jqr(this).attr('id', '');
jqr(this).html('Submit');
} else {
nextSlideQuiz();
}
if (currentSlide > 0) {
jqr("#mqprevQuiz").show();
} else {
jqr("#mqprevQuiz").hide();
}
});
jqr("#mqprevQuiz").on("click", function () {
prevSlideQuiz();
if (currentSlide <= 0) {
jqr(this).hide();
} else {
jqr(this).show();
}
});
// Event handler for previous button click
jqr("#mqprev").on("click", function () {
prevSlide();
if (currentSlide <= 0) {
jqr(this).hide();
} else {
jqr(this).show();
}
});
// Initial show first slide
showCurrentSlide();
// Initial slide index
var currentSlideChild = 0;
var count = 0;
// Function to validate input fields for the current slide
function validateSlidechild() {
console.log('9');
var isValid = true;
if(currentSlideChild === 0 || currentSlideChild > 0){
jqr("#slide"+currentSlideChild+" .rsrequired").each(function (item) {
if(jqr(this).val()==""){
isValid = false;
jqr("#slide"+currentSlideChild+" .error-message").html(jqr(this).attr('title')+' is mandatory!');
} else{
jqr("#slide"+currentSlideChild+" .error-message").html('');
}
});
}
return isValid;
}
// Function to navigate to the next slide
function nextSlideChild() {
console.log('10');
if (validateSlidechild()) {
currentSlideChild++;
showCurrentSlideChild();
}
}
// Function to navigate to the previous slide
function prevSlideChild() {
console.log('11');
currentSlideChild--;
showCurrentSlideChild();
}
// Function to show the current slide and hide others
function showCurrentSlideChild() {
console.log('12');
jqr(".questions").hide();
jqr("#slide" + currentSlideChild).show();
}
// Event handler for next button click
jqr(document).on('click','#next',function(){
var totalsubquestion = (jqr(".questions").length - 1);
console.log(currentSlideChild+"_totalsubquestion_"+totalsubquestion);
if(currentSlideChild == totalsubquestion){
currentSlideChild += 1;
jqr("#slides").hide();
jqr("#subquestionbtn").hide();
if(currentSlide == length){
//alert(currentSlide +' == '+length);
jqr("#mqprev").show();
jqr(this).attr('type', 'submit');
jqr(this).attr('id', '');
jqr(this).html('Register');
}else{
//alert(currentSlide +' else == '+length);
jqr('#mqslides').show();
jqr(".mqquestions").hide();
jqr("#mq_slide" + (currentSlide+1)).show();
jqr('#mqslideButtons').show();
}
} else{
//alert("currentSlideChild"+currentSlideChild);
jqr("#slides").show();
nextSlideChild();
}
});
console.log(currentSlideChild);
// Event handler for previous button click
jqr(document).on('click','#prev',function(){
if(currentSlideChild == 0){
jqr("#slides").hide();
jqr("#subquestionbtn").hide();
jqr('#mqslides').show();
jqr('#mqslideButtons').show();
} else{
prevSlideChild();
}
});
jqr("#FrmRegister").on("submit", function (event) {
// Check if form submission is allowed
if (!allowFormSubmission) {
event.preventDefault();
// You can display a message or take any other action to inform the user.
alert("Please complete the registration process before submitting the form.");
}
});
// Initial show first slide
showCurrentSlideChild();
});
var CHOICES_INSTANCES = {};
var GEOGRAPHY_ARGS = {};
function initializeGeographyDropdown(selectElementId, geographyType, onChange) {
const element = document.getElementById(selectElementId);
var placeholderText = element.getAttribute("placeholder") ?? 'Select a ' + geographyType + '...';
var removeItemButton = (element.dataset.removeItemButton ?? "false") === "true";
var fullWidth = (element.dataset.fullWidth ?? "false") === "true";
var classes = ['choices'];
if (!fullWidth) {
classes.push("width85");
}
CHOICES_INSTANCES[selectElementId] = {
geographyType: geographyType,
onChange: onChange,
element: element,
choices: new Choices(element, {
classNames: {
containerInner: ['choices__inner', "select_home", "form-control"],
containerOuter: classes
},
choices: [],
placeholder: true, // Enable placeholder
placeholderValue: placeholderText,
searchEnabled: true,
searchChoices: true,
removeItemButton: removeItemButton,
duplicateItemsAllowed: false,
searchResultLimit: 10,
renderChoiceLimit: -1,
itemSelectText: '',
shouldSort: false
})
};
}
function convertToIntOrUseString(input) {
const parsedValue = parseInt(input, 10);
// Check if the parsed value is NaN (Not-a-Number)
if (isNaN(parsedValue)) {
return input; // Return the original string if conversion failed
}
return parsedValue; // Return the integer if conversion succeeded
}
function emptyGeographyDropdown(selectElementId) {
var choiceInstance = CHOICES_INSTANCES[selectElementId];
var choices = choiceInstance.choices;
choices.removeActiveItems();
choices.clearChoices();
}
function fillGeographyDropdown(selectElementId, mapper, args) {
var choiceInstance = CHOICES_INSTANCES[selectElementId];
var element = choiceInstance.element;
var choices = choiceInstance.choices;
var geographyType = choiceInstance.geographyType;
var onChange = choiceInstance.onChange;
GEOGRAPHY_ARGS = {...GEOGRAPHY_ARGS, ...args};
var searchParams = new URLSearchParams(GEOGRAPHY_ARGS);
fetch('/get_' + geographyType + '_list.php?' + searchParams.toString())
.then(response => {
if (!response.ok) {
// If the response is not OK, get the response text and throw an error
return response.text().then(text => {
const error = new Error('Network Error');
error.responseText = text;
throw error;
});
}
// Parse the JSON data
return response.json();
})
.then(data => {
// Create a list item for each country and store its ID
const choicesData = data.map(mapper);
const previousValue = element.value; //the value of the selected item.
const initialValue = element.getAttribute('value'); //this is the value when the page is initially loaded (i.e. from the database)
choices.removeActiveItems();
choices.clearChoices();
choices.setChoices(choicesData, 'value', 'label', false);
element.addEventListener('change', function (event) {
var value = event.detail.value;
if (onChange) {
onChange(value);
}
});
var valueToSelect = previousValue === "" ? initialValue : previousValue;
if (geographyType == "city") {
valueToSelect = convertToIntOrUseString(valueToSelect);
}
element.value = valueToSelect;
choices.setChoiceByValue(valueToSelect);
var event = new Event('change');
event.detail = {value: valueToSelect};
element.dispatchEvent(event);
})
.catch(error => {
console.error("Failed to fetch " + geographyType + " list: " + error.message + "==>" + error.responseText);
if (error.responseText) {
console.log(error.responseText);
}
});
}
VALIDATORS = {};
document.addEventListener('DOMContentLoaded', function () {
var loadGeography = false;
if (document.getElementById('countryComboBoxList')
&& document.getElementById('stateComboBoxList')
&& document.getElementById('cityComboBoxList')) {
loadGeography = true;
}
var choicesLibraryIsLoaded = typeof Choices !== 'undefined';
if (loadGeography && choicesLibraryIsLoaded) {
initializeGeographyDropdown('countryComboBoxList', 'country', (country) => {
fillGeographyDropdown('stateComboBoxList', (state) => ({
value: state.id, // Use state code as the value
label: state.name // Use state name as the label
}), {countryCode: country});
emptyGeographyDropdown('cityComboBoxList');
});
initializeGeographyDropdown('stateComboBoxList', 'state', (state) => {
fillGeographyDropdown('cityComboBoxList', (city) => ({
value: city.id, // Use state code as the value
label: city.name // Use state name as the label
}), {stateCode: state});
});
initializeGeographyDropdown('cityComboBoxList', 'city');
fillGeographyDropdown("countryComboBoxList", (country) => ({
value: country.code,
label: country.name
}));
} else {
console.log("INFO: Geography dropdowns not loaded on current page");
}
// Format the country code with a '+' prefix
let countryCodeElement = document.getElementById('country-code');
if(countryCodeElement) {
countryCodeElement.addEventListener('input', function (e) {
let x = e.target.value.replace(/\D/g, ''); // Remove non-numeric characters
e.target.value = '+' + x.slice(0, 3); // Limit to 3 digits for the country code
updateHiddenMobileField();
});
}
let phoneNumberElement = document.getElementById('txtPhone');
if(phoneNumberElement && countryCodeElement) {
// Format the phone number field and handle pasted input with or without country code
phoneNumberElement.addEventListener('input', function (e) {
let x = e.target.value.replace(/\D/g, ''); // Remove all non-numeric characters
// If pasted number includes a country code (e.g., 11234567890), remove first 1-3 digits as country code
if (x.length > 10) {
const countryCode = x.slice(0, x.length - 10); // Get country code
x = x.slice(x.length - 10); //keep only the last 10 digits
countryCodeElement.value = '+' + countryCode;
}
// Format the phone number in (123) 456-7890 style
let formatted = x.match(/(\d{0,3})(\d{0,3})(\d{0,4})/);
e.target.value = !formatted[2] ? formatted[1]
: '(' + formatted[1] + ') ' + formatted[2] + (formatted[3] ? '-' + formatted[3] : '');
updateHiddenMobileField();
});
}
//var VALIDATORS =
document.querySelectorAll('form.validated').forEach(function (form) {
var validator = new JustValidate(form, {
validateBeforeSubmitting: true,
submitFormAutomatically: true,
});
VALIDATORS[form.id] = validator;
var validatedElements = form.querySelectorAll('input.validated , select.validated, textarea.validated');
validatedElements.forEach(function (element) {
var rules = [];
if (element.hasAttribute("required")) {
rules.push({
rule: 'required'
});
}
if (element.hasAttribute("minlength")) {
rules.push({
rule: 'minLength',
value: parseInt(element.getAttribute("minlength"))
});
}
if (element.hasAttribute("type") && element.getAttribute("type") === "date") {
const validationRule = element.dataset.validationRule ?? "";
if (validationRule === "is-18-or-older") {
rules.push({
validator: (value, fields) => {
return is18OrOlder(value);
},
errorMessage: 'You must be 18 or older'
});
}
}
if (element.hasAttribute("type") && element.getAttribute("type") === "email") {
rules.push({
rule: 'email'
});
}
if (element.hasAttribute("type") && element.getAttribute("type") === "password") {
if(element.dataset.validationMatchesElementId) {
//confirm password field
const id = element.dataset.validationMatchesElementId;
rules.push({
validator: (value, fields) => {
const field = document.getElementById(id)
if (field) {
const repeatPasswordValue = field.value;
return value === repeatPasswordValue;
}
return true;
},
errorMessage: 'Passwords should be the same'
});
} else {
//normal password field
rules.push({
rule: 'password'
});
}
}
if (element.hasAttribute("pattern")) {
rules.push({
rule: 'customRegexp',
value: new RegExp(element.getAttribute("pattern"), 'i'),
errorMessage: element.dataset.patternValidationMessage
});
}
if(rules.length > 0) {
var config = {};
if(element.id === "countryComboBoxList") {
config['errorsContainer'] = '#errorLabel-country';
} else if(element.id === "stateComboBoxList") {
config['errorsContainer'] = '#errorLabel-state';
} else if(element.id === "cityComboBoxList") {
config['errorsContainer'] = '#errorLabel-city';
} else if(element.id === 'txtValidOtp') {
config['errorsContainer'] = '#errorLabel-otp';
}
validator.addField(element, rules, config);
}
});
});
});
function updateHiddenMobileField() {
var countryCode = document.getElementById('country-code').value.replace(/\D/g, '');
var phoneNumber = document.getElementById('txtPhone').value.replace(/\D/g, '');
var hiddenMobileField = document.getElementById('txtMobile');
if (phoneNumber.length === 10 && countryCode.length > 0) {
document.getElementById('verifyBtnContainer').style.display = "inline-block";
} else {
document.getElementById('verifyBtnContainer').style.display = "none";
}
hiddenMobileField.value = '+' + countryCode + phoneNumber;
}
function is18OrOlder(birthday) {
const birthDate = new Date(birthday);
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
// Adjust age if birthday hasn't occurred this year yet
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age >= 18;
}
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.add-to-favorite').forEach(clickedElement => {
clickedElement.addEventListener('click', function() {
const userId = this.dataset.userId;
const userName = this.dataset.userName;
fetch('hot-list/' + userId + '/' + userName)
.then(response => {
if (response.status === 200) {
return response.text().then(data => {
alert('Profile was added to Favorites'); // Success message
});
} else {
alert('Could not add user to your favorites.'); // Handle other status codes
}
})
.catch(error => {
alert('An error occurred: ' + error.message); // Network error handling
});
});
});
});
function UnlockCLientUser(leadId, credits){
event.preventDefault();
jQuery.ajax({
url: "unlock_lead_profile.php",
type: "POST",
data: { leadId: leadId, credits: credits },
dataType: "json",
beforeSend: function() {
jQuery("#unlockProfileLink").text("Unlocking...").prop("disabled", true);
},
success: function (response) {
if (response.status === "success") {
alert("Profile Unlocked Successfully!");
} else {
alert("Error: " + response.message);
}
},
error: function () {
alert("An error occurred while unlocking the profile.");
},
complete: function() {
window.location.reload();
}
});
}