1var loadingCount = 0; 2var cookieId = (window.location.hostname.includes('.org') ? window.location.hostname.replace('www.', '') : "maheshwari.org"); 3var apiUrl = !window.location.hostname.includes('localhost') ? "//" + window.location.hostname + (window.location.port != null && window.location.port != "" ? ":" + window.location.port : "") + "/api" : "https://localhost:7052"; 4$.cookie.raw = true; 5$.ajaxSetup({ 6 headers: BearerHeader(), 7 complete: function (xhr) { 8 SetCookie(xhr); 9 } 10}); 11function IncreaseLoadingCount() { 12 $('#loading').removeClass('defaultHide'); 13 loadingCount++; 14} 15function DecreaseLoadingCount() { 16 loadingCount--; 17 if (loadingCount < 0) 18 loadingCount = 0; 19 if (loadingCount == 0) 20 $('#loading').addClass('defaultHide'); 21} 22function CheckBearerHeader() { 23 if (!GetCookie(true)) { 24 if (!!GetCookie()) 25 BootBoxAlert('It seems the information on this page is old. The page will now refresh to get latest information'); 26 else { 27 $('#LoginExtraMessage').html(''); 28 ModalVisibility('#loginModal'); 29 } 30 return false; 31 } 32 else return true; 33} 34function BearerHeader(auth) { 35 var headers = {}; 36 if (!!auth) 37 headers.Authorization = 'Bearer ' + auth; 38 else if (!!$.cookie(cookieId + '-api')) { 39 headers.Authorization = 'Bearer ' + $.cookie(cookieId + '-api'); 40 if (!!$.cookie(cookieId)) 41 headers['Cookie-Key'] = $.cookie(cookieId); 42 } 43 return headers; 44} 45function GetCookie(isApi) { 46 if (!!$.cookie(cookieId + (isApi ? '-api' : ''))) 47 return $.cookie(cookieId + (isApi ? '-api' : '')); 48 return ''; 49} 50function SetCookie(xhr) { 51 if (!!xhr.getResponseHeader(cookieId + '-api')) { 52 if (xhr.getResponseHeader(cookieId + '-api') == cookieId + '-api') 53 DeleteCookie(true); 54 else if (xhr.getResponseHeader(cookieId + '-api') != ".") 55 $.cookie(cookieId + '-api', xhr.getResponseHeader(cookieId + '-api'), { path: '/', expires: + 6 / 24 }); 56 } 57 if (!!xhr.getResponseHeader(cookieId)) { 58 if (xhr.getResponseHeader(cookieId) == cookieId) 59 DeleteCookie(); 60 else if (xhr.getResponseHeader(cookieId) != ".") 61 $.cookie(cookieId, xhr.getResponseHeader(cookieId), { path: '/', expires: + 30 }); 62 } 63} 64function DeleteCookie(isApi) { 65 if (!!$.cookie(cookieId + (isApi ? '-api' : ''))) 66 $.removeCookie(cookieId + (isApi ? '-api' : '')); 67} 68function ErrorRedirect(result, errorLabel) { 69 if (result.responseJSON == undefined) { 70 if (result.status == 413 || result.status == 502) 71 if (errorLabel) 72 $(errorLabel).text('File Size Too Big').show(); 73 else 74 alert('File Size Too Big'); 75 } 76 else if (result.responseJSON.status == 401) { 77 LPush({ 'event': 'session_expired', 'reason': 'token_expired' }); 78 RefreshMemberOnWebsite(); 79 DeleteCookie(true); 80 $(location).prop('href', '/user/login.aspx'); 81 } 82 else if (result.responseJSON.status == 400) { 83 if (result.responseJSON.title.includes("validation")) { 84 if (errorLabel) 85 $(errorLabel).text(result.responseJSON.title).show(); 86 else 87 alert(result.responseJSON.title); 88 } 89 } 90 DecreaseLoadingCount(); 91} 92function ScrollToTop() { 93 document.body.scrollTop = 0; // For Safari 94 document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera 95} 96function getParameter(key) { 97 const newParams = new URLSearchParams(); 98 new URLSearchParams(window.location.search).forEach(function (value, key) { newParams.append(key.toLowerCase(), value); }); 99 return newParams.get(key.toLowerCase()); 100} 101function RefreshMemberOnWebsite() { 102 $.ajax({ 103 url: "//" + window.location.host + "/services/webservice.asmx/RefreshMember" 104 }); 105} 106function ClearSessionOnWebsite() { 107 $.ajax({ 108 url: "//" + window.location.host + "/services/webservice.asmx/ClearSession" 109 }); 110} 111function Login(profileId, password, relation, saveCookie, error) { 112 if (!!$('#' + profileId).val().trim() && !!$('#' + password).val().trim()) 113 if ($('#' + relation).val() == "0" && !$('#' + profileId).val().trim().toLowerCase().startsWith('t')) 114 alert("To improve User Experience, we need to know how you are related to the registered user. Please enter the relation"); 115 else if ($('#' + profileId).val().trim().toLowerCase().startsWith('t')) 116 $(location).prop('href', '/user/loged.aspx?Matcode=' + $('#' + profileId).val().trim() + '&Password=' + $('#' + password).val()); 117 else if (/[^\x00-\xFF]/.test($('#' + password).val())) 118 $('#' + error).html('Your password contains characters that are not allowed. Please check your keyboard\'s language/input mode and try again.'); 119 else { 120 $('#' + error).html(''); 121 LPush({ 'event': 'login_attempted', 'method': 'password' }); 122 $.ajax({
123 url: apiUrl + '/user/authenticate', 124 type: 'GET', 125 headers: { "Authorization": "Basic " + btoa($('#' + profileId).val() + ":" + $('#' + password).val() + ":" + $('#' + relation).val() + ":" + $('#' + saveCookie).prop('checked')) }, 126 success: function (result) { 127 if (result.Authenticated) { 128 LPush({ 'event': 'login_success', 'method': 'password' }); 129 sessionStorage.setItem('justLoggedIn', '1'); 130 setTimeout(function () { 131 if ($(location).prop('href').includes('logout.aspx')) 132 $(location).prop('href', '/user/main.aspx'); 133 else 134 location.reload(); 135 }, 1000); 136 } else { 137 var _reason = (result.Message && result.Message.toLowerCase().includes('removed')) 138 ? 'account_inactive' : 'wrong_credentials'; 139 LPush({ 'event': 'login_failed', 'method': 'password', 'reason': _reason }); 140 $('#' + error).html(result.Message); 141 } 142 } 143 }); 144 } 145 else 146 $('#' + error).html('Please enter profile id and password to login'); 147} 148function PostRegistrationLogin(profileId, password, relation, callback) { 149 if (!!profileId && !!password) 150 $.ajax({ 151 url: apiUrl + '/user/authenticate', 152 type: 'GET', 153 headers: { "Authorization": "Basic " + btoa(profileId + ":" + password + ":" + relation + ":" + true) }, 154 complete: function (xhr) { 155 SetCookie(xhr); //Per-call complete replaces the global one set in $.ajaxSetup 156 if (!!callback) 157 callback(); 158 } 159 }); 160 else if (!!callback) 161 callback(); 162} 163function LoadData(page, params) { 164 IncreaseLoadingCount(); 165 switch (page.toLowerCase()) { 166 case "kundali-milan": 167 if (CheckBearerHeader()) 168 if (!!params) 169 $.ajax({
170 url: apiUrl + '/kundalimilan/view?MatchId=' + params, 171 type: 'GET', 172 success: function (result) { 173 KundaliMilan_LoadData(result); 174 DecreaseLoadingCount(); 175 }, 176 error: function (result) { 177 ErrorRedirect(result); 178 } 179 }); 180 else { 181 KundaliMilan_LoadData(new Object({ MatchId: 0 })); 182 DecreaseLoadingCount(); 183 } 184 break; 185 case "kundali-milan-list": 186 if (CheckBearerHeader()) 187 $.ajax({ 188 url: apiUrl + '/kundalimilan/list?PageNumber=' + params, 189 type: 'GET', 190 success: function (result) { 191 KundaliMilanList_LoadData(result); 192 DecreaseLoadingCount(); 193 }, 194 error: function (result) { 195 ErrorRedirect(result); 196 } 197 }); 198 break; 199 case "kundali-milan-edit": 200 if (CheckBearerHeader()) 201 if (!!params) 202 $.ajax({ 203 url: apiUrl + '/kundalimilan/viewinput?MatchId=' + params, 204 type: 'GET', 205 success: function (result) { 206 KundaliMilanEdit_LoadData(result); 207 DecreaseLoadingCount(); 208 }, 209 error: function (result) { 210 ErrorRedirect(result); 211 } 212 }); 213 else { 214 KundaliMilanEdit_LoadData(new Object({ MatchId: 0 })); 215 DecreaseLoadingCount(); 216 } 217 break; 218 case "success-story": 219 if (!!params) 220 $.ajax({
221 url: apiUrl + '/successstory/view?StoryId=' + params, 222 type: 'GET', 223 success: function (result) { 224 SuccessStory_LoadData(result); 225 DecreaseLoadingCount(); 226 } 227 }); 228 else 229 SuccessStory_LoadData(new Object({ StoryId: 0 })); 230 break; 231 case "success-stories": 232 $.ajax({ 233 url: apiUrl + '/successstory/list?PageNumber=' + params, 234 type: 'GET', 235 success: function (result) { 236 SuccessStoryList_LoadData(result); 237 DecreaseLoadingCount(); 238 } 239 }); 240 break; 241 case "share-success-story": 242 DecreaseLoadingCount(); 243 $.ajax({ 244 url: apiUrl + '/user/basic', 245 type: 'GET', 246 success: function (result) { 247 SuccessStory_LoadPreInsertData(result); 248 } 249 }); 250 break; 251 case "feedback": 252 DecreaseLoadingCount(); 253 $.ajax({ 254 url: apiUrl + '/user/basic', 255 type: 'GET', 256 success: function (result) { 257 Feedback_LoadPreInsertData(result); 258 } 259 }); 260 break; 261 case "verify-email": 262 DecreaseLoadingCount(); 263 var url; 264 if (!!getParameter("em")) 265 url = '/user/email/verify?em=' + getParameter("em"); 266 else if (!!getParameter("token")) 267 url = '/registration/verifyemail?token=' + getParameter("token"); 268 else if (!!getParameter("mtoken")) 269 url = '/registration/verifymobile?token=' + getParameter("mtoken"); 270 $.ajax({ 271 url: apiUrl + url, 272 type: 'GET', 273 success: function (result) { 274 VerifyEmail_LoadData(result); 275 DecreaseLoadingCount(); 276 } 277 }); 278 break; 279 case "request-city": 280 $.ajax({ 281 url: apiUrl + '/city/countrylist', 282 type: 'GET', 283 success: function (result) { 284 RequestCity_LoadData(result); 285 } 286 }); 287 break; 288 case "complete-profile": 289 if (CheckBearerHeader()) 290 $.ajax({
291 url: apiUrl + '/user/statistics', 292 type: 'GET', 293 success: function (result) { 294 CompleteProfile_LoadData(result); 295 DecreaseLoadingCount(); 296 } 297 }); 298 break; 299 case "profile-view": 300 $.ajax({ 301 url: apiUrl + '/profile/view?ProfileId=' + params, 302 type: 'GET', 303 success: function (result) { 304 DecreaseLoadingCount(); 305 ProfileView_LoadData(result); 306 } 307 }); 308 break; 309 case "profile-view-contact": 310 $.ajax({ 311 url: apiUrl + '/profile/view-contact?ProfileId=' + params, 312 type: 'GET', 313 success: function (result) { 314 DecreaseLoadingCount(); 315 ProfileView_LoadDataSegment('Contact', result); 316 } 317 }); 318 break; 319 case "profile-print": 320 if (CheckBearerHeader()) { 321 $.ajax({ 322 url: apiUrl + '/profile/print?ProfileId=' + params, 323 type: 'GET', 324 success: function (result) { 325 DecreaseLoadingCount(); 326 ProfilePrint_LoadData(result); 327 } 328 }); 329 } 330 break; 331 case "get-search-criteria": 332 $.ajax({ 333 url: apiUrl + '/user/basic', 334 type: 'GET', 335 success: function (result) { 336 SearchCriteria_LoadUserData(result); 337 } 338 }); 339 $.ajax({ 340 url: apiUrl + '/search/get-search-criteria?SearchId=' + params, 341 type: 'GET', 342 success: function (result) { 343 SearchCriteria_LoadData(result); 344 DecreaseLoadingCount(); 345 } 346 }); 347 break; 348 case "get-saved-search-list": 349 if (BearerHeader().Authorization) 350 $.ajax({
351 url: apiUrl + '/search/get-saved-search-list', 352 type: 'GET', 353 success: function (result) { 354 SearchCriteria_LoadSavedSearchData(result); 355 DecreaseLoadingCount(); 356 }, 357 error: function () { 358 SearchCriteria_SavedSearchErrorMessage("Please Login to view your Saved Searches"); 359 DecreaseLoadingCount(); 360 } 361 }); 362 else { 363 SearchCriteria_SavedSearchErrorMessage("Please Login to view your Saved Searches"); 364 DecreaseLoadingCount(); 365 } 366 break; 367 case "get-search-result": 368 $.ajax({ 369 url: apiUrl + '/search/get-search-result', 370 type: 'POST', 371 data: params, 372 contentType: "application/json", 373 success: function (result) { 374 SearchResult_LoadData(result); 375 DecreaseLoadingCount(); 376 } 377 }); 378 break; 379 case "get-photo-album-list": 380 if (CheckBearerHeader()) 381 $.ajax({ 382 url: apiUrl + '/user/photo/list', 383 type: 'GET', 384 success: function (result) { 385 PhotoAlbumList_LoadData(result); 386 DecreaseLoadingCount(); 387 }, 388 error: function (result) { 389 ErrorRedirect(result); 390 } 391 }); 392 break; 393 case "settings-basic": 394 if (CheckBearerHeader()) 395 $.ajax({
396 url: apiUrl + '/user/basic', 397 type: 'GET', 398 headers: BearerHeader(), //BearerHeader not getting called afresh from inside a success function of another ajax. Thus, explicitely added here 399 success: function (result) { 400 DecreaseLoadingCount(); 401 EmailPassword_LoadData(result); 402 } 403 }); 404 else 405 DecreaseLoadingCount(); 406 break; 407 case "settings-preference": 408 if (CheckBearerHeader()) 409 $.ajax({ 410 url: apiUrl + '/user/settings/get-preference', 411 type: 'GET', 412 success: function (result) { 413 DecreaseLoadingCount(); 414 Preference_LoadData(result); 415 }, 416 error: function (result) { 417 ErrorRedirect(result); 418 } 419 }); 420 else 421 DecreaseLoadingCount(); 422 break; 423 case "settings-email-preference": 424 if (CheckBearerHeader()) 425 $.ajax({ 426 url: apiUrl + '/user/settings/get-email-preference', 427 type: 'GET', 428 success: function (result) { 429 DecreaseLoadingCount(); 430 EmailPreference_LoadData(result); 431 }, 432 error: function (result) { 433 ErrorRedirect(result); 434 } 435 }); 436 else 437 DecreaseLoadingCount(); 438 break; 439 case "settings-check-auth": 440 DecreaseLoadingCount(); 441 $.ajax({ 442 url: apiUrl + '/user/basic', 443 type: 'GET', 444 headers: BearerHeader(getParameter("auth")), 445 success: function (result) { 446 ProfileRemove_CheckAuthData(result); 447 } 448 }); 449 break; 450 case "unsubscribe": 451 $.ajax({ 452 url: apiUrl + '/general/email/basic?' + params, 453 type: 'GET', 454 success: function (result) { 455 Unsubscribe_LoadData(result); 456 DecreaseLoadingCount(); 457 } 458 }); 459 break; 460 case "unsubscribe-t": 461 $.ajax({ 462 url: apiUrl + '/general/email-t/check?' + params, 463 type: 'GET', 464 success: function (result) { 465 UnsubscribeT_LoadData(result); 466 DecreaseLoadingCount(); 467 } 468 }); 469 break; 470 case "website-contact": 471 $.ajax({ 472 url: apiUrl + '/general/contact', 473 type: 'GET', 474 success: function (result) { 475 Contact_LoadData(result); 476 DecreaseLoadingCount(); 477 } 478 }); 479 break; 480 case "payment-plans": 481 $.ajax({ 482 url: apiUrl + '/payment/plans', 483 type: 'GET', 484 success: function (result) { 485 MembershipPlans_LoadData(result); 486 DecreaseLoadingCount(); 487 } 488 }); 489 break; 490 case "payment-details": 491 if (CheckBearerHeader()) { 492 $.ajax({
493 url: apiUrl + '/payment/detail', 494 type: 'GET', 495 success: function (result) { 496 PaymentDetails_LoadData(result); 497 DecreaseLoadingCount(); 498 }, 499 error: function (result) { 500 ErrorRedirect(result); 501 } 502 503 }); 504 } 505 break; 506 case "payment-response": 507 if (CheckBearerHeader()) { 508 $.ajax({ 509 url: apiUrl + '/payment/response?OrderId=' + params, 510 type: 'GET', 511 success: function (result) { 512 DecreaseLoadingCount(); 513 PaymentResponse_LoadData(result); 514 }, 515 error: function (result) { 516 DecreaseLoadingCount(); 517 ErrorRedirect(result); 518 } 519 520 }); 521 } 522 break; 523 case "home-profile-info": 524 if (CheckBearerHeader()) { 525 $.ajax({ 526 url: apiUrl + '/user/statistics?HomePage=true', 527 type: 'GET', 528 success: function (result) { 529 Home_LoadProfileData(result); 530 DecreaseLoadingCount(); 531 } 532 }); 533 } 534 break; 535 case "home-ai-import": 536 if (CheckBearerHeader()) { 537 $.ajax({ 538 url: apiUrl + '/ai/import-pending', 539 type: 'GET', 540 success: function (result) { 541 Home_LoadAIImport(result); 542 DecreaseLoadingCount(); 543 } 544 }); 545 } 546 break; 547 case "home-trivia": 548 DecreaseLoadingCount(); 549 $.ajax({ 550 url: apiUrl + '/user/trivia', 551 type: 'GET', 552 success: function (result) { 553 Home_LoadTrivia(result); 554 } 555 }); 556 break; 557 case "ed-update": 558 DecreaseLoadingCount(); 559 $.ajax({ 560 url: apiUrl + '/general/email/track?' + params, 561 type: 'GET', 562 success: function (result) { 563 if (!!result) 564 $('body').append($('<img/>').prop('src', result).hide()); 565 } 566 }); 567 break; 568 case "edt-update": 569 DecreaseLoadingCount(); 570 $.ajax({ 571 url: apiUrl + '/general/email-t/track?' + params, 572 type: 'GET', 573 success: function (result) { 574 if (!!result) 575 $('body').append($('<img/>').prop('src', result).hide()); 576 } 577 }); 578 break; 579 case "chat-count": 580 DecreaseLoadingCount(); 581 if (CheckBearerHeader()) { 582 $.ajax({
583 url: apiUrl + '/communication/chat-count', 584 type: 'GET', 585 success: function (result) { 586 ChatCount_LoadData(result); 587 }, 588 error: function (result) { 589 ErrorRedirect(result); 590 } 591 }); 592 } 593 break; 594 case "update-partner": 595 case "update-personal": 596 case "update-professional": 597 case "update-family": 598 case "update-detail": 599 case "update-address": 600 case "update-horoscope": 601 case "update-social": 602 case "update-biodata": 603 case "update-fo": 604 case "update-phone": 605 case "update-all": 606 var type = page.substring(7); 607 if (CheckBearerHeader()) { 608 $.ajax({ 609 url: apiUrl + '/user/' + type.toLowerCase() + '/get', 610 type: 'GET', 611 success: function (result) { 612 Update_LoadData(result, type); 613 } 614 }); 615 } 616 else 617 DecreaseLoadingCount(); 618 break; 619 case "register-sno": 620 DecreaseLoadingCount(); 621 $.ajax({ 622 type: 'GET', 623 url: apiUrl + "/registration/loadincompleteregister?SNoKey=" + encodeURIComponent(params), 624 success: function (result) { 625 SNoLoaded(result); 626 } 627 }); 628 break; 629 case "register-treg": 630 DecreaseLoadingCount(); 631 $.ajax({ 632 type: 'GET', 633 url: apiUrl + "/registration/loadtemporaryregister?" + params, 634 success: function (result) { 635 TRegLoaded(result); 636 } 637 }); 638 break; 639 case "firebase": 640 DecreaseLoadingCount(); 641 $.ajax({ 642 url: apiUrl + '/general/firebase', 643 type: 'GET', 644 success: function (result) { 645 Firebase_LoadData(result); 646 } 647 }); 648 break; 649 case "check-online": 650 DecreaseLoadingCount(); 651 $.ajax({ 652 url: apiUrl + '/chat/online/' + params, 653 type: 'GET', 654 success: function (result) { 655 CheckOnline_LoadData(result); 656 }, 657 error: function (result) { 658 CheckOnline_LoadData(false); 659 } 660 }); 661 break; 662 default: 663 break; 664 } 665} 666function Action(action, params, errorLabel, funcParams) { 667 switch (action.toLowerCase()) { 668 case "kundali-milan-list-remove": 669 if (CheckBearerHeader()) { 670 IncreaseLoadingCount(); 671 $.ajax({
672 url: apiUrl + '/kundalimilan/remove', 673 type: 'POST', 674 data: params, 675 contentType: "application/json", 676 success: function (result) { 677 KundaliMilanList_Remove(result); 678 DecreaseLoadingCount(); 679 }, 680 error: function (result) { 681 ErrorRedirect(result); 682 } 683 }); 684 } 685 break; 686 case "kundali-milan-edit": 687 if (CheckBearerHeader()) { 688 IncreaseLoadingCount(); 689 $.ajax({ 690 url: apiUrl + '/kundalimilan/update', 691 type: 'POST', 692 data: params, 693 contentType: "application/json", 694 success: function (result) { 695 KundaliMilanEdit_Update(result, errorLabel); 696 DecreaseLoadingCount(); 697 }, 698 error: function (result) { 699 ErrorRedirect(result, errorLabel); 700 } 701 }); 702 } 703 break; 704 case "share-success-story": 705 IncreaseLoadingCount(); 706 $.ajax({ 707 url: apiUrl + '/successstory/add', 708 type: 'POST', 709 data: params, 710 contentType: false, 711 processData: false, 712 success: function (result) { 713 SuccessStory_Insert(result, errorLabel); 714 DecreaseLoadingCount(); 715 }, 716 error: function (result) { 717 ErrorRedirect(result, errorLabel); 718 } 719 }); 720 break; 721 case "feedback": 722 IncreaseLoadingCount(); 723 $.ajax({ 724 url: apiUrl + '/feedback/send', 725 type: 'POST', 726 data: params, 727 contentType: "application/json", 728 success: function (result) { 729 Feedback_Submit(result, errorLabel); 730 DecreaseLoadingCount(); 731 }, 732 error: function (result) { 733 ErrorRedirect(result, errorLabel); 734 } 735 }); 736 break; 737 case "forgot-password": 738 IncreaseLoadingCount(); 739 $.ajax({ 740 url: apiUrl + '/user/forgot-password', 741 type: 'GET', 742 data: params, 743 success: function (result) { 744 ForgotPassword_Submit(result, errorLabel); 745 DecreaseLoadingCount(); 746 }, 747 error: function (result) { 748 ErrorRedirect(result, errorLabel); 749 } 750 }); 751 break; 752 case "profile-perform-action": 753 if (!GuestUser()) { 754 IncreaseLoadingCount(); 755 LPush({ 'event': 'profile_action_taken', 756 'action': params.Command.toLowerCase().replace(/-/g, '_'), 757 'target_profile_id': params.Id, 758 'source_page': 'profile', 759 'source': params._Source || null }); 760 delete params._Source; 761 $.ajax({
762 url: apiUrl + '/profile/perform-action', 763 type: 'POST', 764 data: JSON.stringify(params), 765 contentType: "application/json", 766 success: function (result) { 767 ProfileView_LoadDataSegment("Interaction", result); 768 DecreaseLoadingCount(); 769 } 770 }); 771 } 772 break; 773 case "search-perform-action": 774 if (!GuestUser()) { 775 IncreaseLoadingCount(); 776 LPush({ 'event': 'profile_action_taken', 777 'action': params.Command.toLowerCase().replace(/-/g, '_'), 778 'target_profile_id': params.Id, 779 'source_page': 'search_result', 780 'result_page_type': resultPageId || null }); 781 if (resultPageId != null && resultPageId != 0) 782 params.ResultPageType = resultPageId; 783 $.ajax({ 784 url: apiUrl + '/search/perform-action', 785 type: 'POST', 786 data: JSON.stringify(params), 787 contentType: "application/json", 788 success: function (result) { 789 SearchResult_ActionResult(result); 790 DecreaseLoadingCount(); 791 } 792 }); 793 } 794 break; 795 796 case "profile-view-pages": 797 jQuery.ajax({ 798 url: apiUrl + '/profile/view-pages', 799 type: 'POST', 800 data: JSON.stringify(params), 801 contentType: "application/json" 802 }); 803 break; 804 case "search-view-history": 805 if (CheckBearerHeader()) { 806 IncreaseLoadingCount(); 807 jQuery.ajax({ 808 url: apiUrl + '/profile/view-history?ProfileId=' + params, 809 type: 'GET', 810 data: JSON.stringify(params), 811 contentType: "application/json", 812 success: function (result) { 813 History_LoadData(result); 814 DecreaseLoadingCount(); 815 } 816 }); 817 } 818 break; 819 case "profile-biodata-download": 820 case "update-biodata-download": 821 if (CheckBearerHeader()) { 822 IncreaseLoadingCount(); 823 $.ajax({
824 url: apiUrl + '/profile/biodata-download', 825 type: 'GET', 826 data: "ProfileId=" + params, 827 xhrFields: { 828 responseType: 'blob' // to avoid binary data being mangled on charset conversion 829 }, 830 success: function (result, status, xhr) { 831 BiodataDownload(result, xhr.getResponseHeader('Content-Disposition')); 832 DecreaseLoadingCount(); 833 }, 834 error: function (result) { 835 var reason = result.getResponseHeader('Reason'); 836 var message = ''; 837 switch (result.status) { 838 case 401: 839 message = 'There was an issue with downloading this biodata. ' + reason + '. If you feel this is a mistake, please contact our helpline.'; 840 break; 841 default: 842 message = 'Error Code ' + result.status + + '. Please try after some time. If the problem persists, please contact our helpline.'; 843 } 844 if (!errorLabel) 845 BootBoxAlert(message); 846 else 847 $(errorLabel).text(message); 848 DecreaseLoadingCount(); 849 } 850 }); 851 } 852 break; 853 case "request-city-state-list": 854 $.ajax({ 855 url: apiUrl + '/city/statelist', 856 type: 'GET', 857 data: "CountryCode=" + params, 858 success: function (result) { 859 RequestCity_LoadStateData(result); 860 } 861 }); 862 break; 863 case "request-city-add-city": 864 $.ajax({ 865 url: apiUrl + '/city/addcity', 866 type: 'POST', 867 data: params, 868 contentType: "application/json", 869 success: function (result) { 870 RequestCity_AddCity(result); 871 }, 872 error: function (result) { 873 ErrorRedirect(result); 874 } 875 }); 876 break; 877 case "complete-profile-claim": 878 if (CheckBearerHeader()) 879 $.ajax({
880 url: apiUrl + '/user/claim-free-membership', 881 type: 'GET', 882 success: function (result) { 883 CompleteProfile_Claim(result); 884 } 885 }); 886 break; 887 case "search-criteria-set": 888 IncreaseLoadingCount(); 889 $.ajax({ 890 url: apiUrl + '/search/set-search-criteria', 891 type: 'POST', 892 data: params, 893 contentType: "application/json", 894 success: function (result) { 895 SearchCriteria_Submit(result); 896 DecreaseLoadingCount(); 897 } 898 }); 899 break; 900 case "saved-search-remove": 901 if (CheckBearerHeader()) { 902 IncreaseLoadingCount(); 903 $.ajax({ 904 url: apiUrl + '/search/delete-saved-search?SearchId=' + params, 905 type: 'GET', 906 success: function () { 907 LoadData("get-saved-search-list") 908 DecreaseLoadingCount(); 909 } 910 }); 911 } 912 break; 913 case "photo-album-remove": 914 if (CheckBearerHeader()) { 915 IncreaseLoadingCount(); 916 $.ajax({ 917 url: apiUrl + '/user/photo/remove', 918 type: 'POST', 919 data: params, 920 contentType: "application/json", 921 success: function (result) { 922 PhotoAlbumList_LoadData(result); 923 DecreaseLoadingCount(); 924 RefreshMemberOnWebsite(); 925 }, 926 error: function (result) { 927 ErrorRedirect(result); 928 } 929 }); 930 } 931 break; 932 case "photo-album-make-default": 933 if (CheckBearerHeader()) { 934 IncreaseLoadingCount(); 935 $.ajax({
936 url: apiUrl + '/user/photo/make-default', 937 type: 'POST', 938 data: params, 939 contentType: "application/json", 940 success: function (result) { 941 PhotoAlbumList_LoadData(result); 942 DecreaseLoadingCount(); 943 RefreshMemberOnWebsite(); 944 }, 945 error: function (result) { 946 ErrorRedirect(result); 947 } 948 }); 949 } 950 break; 951 case "photo-album-crop": 952 if (CheckBearerHeader()) { 953 IncreaseLoadingCount(); 954 $.ajax({ 955 url: apiUrl + '/user/photo/crop', 956 type: 'POST', 957 data: params, 958 contentType: "application/json", 959 success: function (result) { 960 PhotoAlbum_Crop(result); 961 DecreaseLoadingCount(); 962 }, 963 error: function (result) { 964 ErrorRedirect(result); 965 } 966 }); 967 } 968 break; 969 case "settings-preference-update": 970 if (CheckBearerHeader()) { 971 IncreaseLoadingCount(); 972 $.ajax({ 973 url: apiUrl + '/user/settings/set-preference', 974 type: 'POST', 975 data: params, 976 contentType: "application/json", 977 success: function (result) { 978 PreferenceEdit_LoadData(result, errorLabel); 979 DecreaseLoadingCount(); 980 }, 981 error: function (result) { 982 ErrorRedirect(result, errorLabel); 983 } 984 }); 985 } 986 break; 987 case "settings-password-update": 988 if (CheckBearerHeader()) { 989 IncreaseLoadingCount(); 990 $.ajax({
991 url: apiUrl + '/user/settings/set-password', 992 type: 'POST', 993 data: params, 994 contentType: "application/json", 995 success: function (result, status, xhr) { 996 SetCookie(xhr); 997 EmailPasswordEdit_LoadData(result, errorLabel); 998 DecreaseLoadingCount(); 999 }, 1000 error: function (result) { 1001 ErrorRedirect(result, errorLabel); 1002 } 1003 }); 1004 } 1005 break; 1006 case "settings-email-update": 1007 if (CheckBearerHeader()) { 1008 IncreaseLoadingCount(); 1009 $.ajax({ 1010 url: apiUrl + '/user/email/set?EmailId=' + params, 1011 type: 'GET', 1012 success: function (result) { 1013 EmailPasswordEdit_LoadData(result, errorLabel); 1014 DecreaseLoadingCount(); 1015 }, 1016 error: function (result) { 1017 ErrorRedirect(result, errorLabel); 1018 } 1019 }); 1020 } 1021 break; 1022 case "settings-email-send-verification": 1023 if (CheckBearerHeader()) { 1024 IncreaseLoadingCount(); 1025 $.ajax({ 1026 url: apiUrl + '/user/email/send-verification?EmailId=' + params, 1027 type: 'GET', 1028 success: function (result) { 1029 EmailPasswordEdit_LoadData(result, errorLabel); 1030 DecreaseLoadingCount(); 1031 }, 1032 error: function (result) { 1033 ErrorRedirect(result, errorLabel); 1034 } 1035 }); 1036 } 1037 break; 1038 case "settings-email-preference-update": 1039 if (CheckBearerHeader()) { 1040 IncreaseLoadingCount(); 1041 $.ajax({
1042 url: apiUrl + '/user/settings/set-email-preference', 1043 type: 'POST', 1044 data: params, 1045 contentType: "application/json", 1046 success: function (result) { 1047 PreferenceEdit_LoadData(result, errorLabel); 1048 DecreaseLoadingCount(); 1049 }, 1050 error: function (result) { 1051 ErrorRedirect(result, errorLabel); 1052 } 1053 }); 1054 } 1055 break; 1056 case "settings-profile-remove": 1057 IncreaseLoadingCount(); 1058 $.ajax({ 1059 url: apiUrl + '/user/remove', 1060 type: 'POST', 1061 data: params, 1062 contentType: "application/json", 1063 success: function (result) { 1064 ProfileRemoved_LoadData(result, errorLabel); 1065 DecreaseLoadingCount(); 1066 }, 1067 error: function (result) { 1068 ErrorRedirect(result, errorLabel); 1069 } 1070 }); 1071 break; 1072 case "unsubscribe-update": 1073 IncreaseLoadingCount(); 1074 $.ajax({ 1075 url: apiUrl + '/general/email/update', 1076 type: 'POST', 1077 data: params, 1078 contentType: "application/json", 1079 success: function (result) { 1080 UnsubscribeSubmitted_LoadData(result, JSON.parse(params).EmailPreference, errorLabel); 1081 DecreaseLoadingCount(); 1082 }, 1083 error: function (result) { 1084 ErrorRedirect(result, errorLabel); 1085 } 1086 }); 1087 break; 1088 case "unsubscribe-t-update": 1089 IncreaseLoadingCount(); 1090 $.ajax({ 1091 url: apiUrl + '/general/email-t/update', 1092 type: 'POST', 1093 data: params, 1094 contentType: "application/json", 1095 success: function (result) { 1096 UnsubscribeSubmitted_LoadData(result, JSON.parse(params).EmailPreference, errorLabel); 1097 DecreaseLoadingCount(); 1098 }, 1099 error: function (result) { 1100 ErrorRedirect(result, errorLabel); 1101 } 1102 }); 1103 break; 1104 case "payment-calculate-discount": 1105 if (CheckBearerHeader()) { 1106 $.ajax({
1107 url: apiUrl + '/payment/discount?' + params, 1108 type: 'GET', 1109 success: function (result) { 1110 PaymentDetails_LoadDiscountData(result); 1111 } 1112 }); 1113 } 1114 break; 1115 case "payment-pay": 1116 if (CheckBearerHeader()) { 1117 $('#ajBtnContinue').prop('disabled', true); 1118 setTimeout(function () { $('#ajBtnContinue').prop('disabled', false); }, 3000); 1119 $.ajax({ 1120 url: apiUrl + '/payment/pay', 1121 type: 'POST', 1122 data: params, 1123 contentType: "application/json", 1124 success: function (result) { 1125 PaymentDetails_LoadGatewayInfo(result); 1126 } 1127 }); 1128 } 1129 break; 1130 case "update-personal": 1131 case "update-partner": 1132 case "update-professional": 1133 case "update-family": 1134 case "update-detail": 1135 case "update-address": 1136 case "update-horoscope": 1137 case "update-social": 1138 case "update-fo": 1139 case "update-biodata": 1140 case "update-phone": 1141 var type = action.substring(7); 1142 if (CheckBearerHeader()) { 1143 $('#loading' + (type != 'partner' ? '-' + type : '')).removeClass('defaultHide'); 1144 $.ajax({
1145 url: apiUrl + '/user/' + type.toLowerCase() + '/set', 1146 type: 'POST', 1147 data: params, 1148 contentType: "application/json", 1149 success: function (result) { 1150 $('#loading' + (type != 'partner' ? '-' + type : '')).addClass('defaultHide'); 1151 Update_Save(result, type, funcParams); 1152 }, 1153 error: function (result) { 1154 $('#loading' + (type != 'partner' ? '-' + type : '')).addClass('defaultHide'); 1155 ErrorRedirect(result); 1156 } 1157 }); 1158 } 1159 break; 1160 case "update-phone-send-otp": 1161 if (CheckBearerHeader()) { 1162 $('#loading-phone').removeClass('defaultHide'); 1163 $.ajax({ 1164 url: apiUrl + '/user/phone/send-otp?PhoneId=' + params, 1165 type: 'GET', 1166 success: function (result) { 1167 $('#loading-phone').addClass('defaultHide'); 1168 Update_SendOTPResponse(result, params); 1169 }, 1170 error: function (result) { 1171 $('#loading-phone').addClass('defaultHide'); 1172 ErrorRedirect(result); 1173 } 1174 }); 1175 } 1176 break; 1177 case "update-phone-verify-otp": 1178 if (CheckBearerHeader()) { 1179 $('#loading-phone').removeClass('defaultHide'); 1180 $.ajax({
1181 url: apiUrl + '/user/phone/verify-otp?' + params, 1182 type: 'GET', 1183 success: function (result) { 1184 $('#loading-phone').addClass('defaultHide'); 1185 Update_VerifyOTPResponse(result, params); 1186 }, 1187 error: function (result) { 1188 $('#loading-phone').addClass('defaultHide'); 1189 ErrorRedirect(result); 1190 } 1191 }); 1192 } 1193 break; 1194 case "update-biodata-remove": 1195 if (CheckBearerHeader()) { 1196 $('#loading-Biodata').removeClass('defaultHide'); 1197 $.ajax({ 1198 url: apiUrl + '/user/biodata/remove', 1199 type: 'POST', 1200 data: params, 1201 contentType: "application/json", 1202 success: function (result) { 1203 $('#loading-Biodata').addClass('defaultHide'); 1204 Update_Save(result, 'Biodata'); 1205 }, 1206 error: function (result) { 1207 $('#loading-Biodata').addClass('defaultHide'); 1208 ErrorRedirect(result); 1209 } 1210 }); 1211 } 1212 break; 1213 case "update-fo-swap": 1214 case "update-phone-swap": 1215 var type = action.split('-')[1]; 1216 if (CheckBearerHeader()) { 1217 $('#loading-' + type).removeClass('defaultHide'); 1218 $.ajax({
1219 url: apiUrl + '/user/' + type.toLowerCase() + '/swap?' + params, 1220 type: 'GET', 1221 success: function (result) { 1222 $('#loading-' + type).addClass('defaultHide'); 1223 Update_Swap(result, params, type); 1224 }, 1225 error: function (result) { 1226 $('#loading-' + type).addClass('defaultHide'); 1227 ErrorRedirect(result); 1228 } 1229 }); 1230 } 1231 break; 1232 case "update-fo-remove": 1233 case "update-phone-remove": 1234 var type = action.split('-')[1]; 1235 if (CheckBearerHeader()) { 1236 $('#loading-' + type).removeClass('defaultHide'); 1237 $.ajax({ 1238 url: apiUrl + '/user/' + type.toLowerCase() + '/remove?' + params, 1239 type: 'GET', 1240 success: function (result) { 1241 $('#loading-' + type).addClass('defaultHide'); 1242 Update_Remove(result, params, type); 1243 }, 1244 error: function (result) { 1245 $('#loading-' + type).addClass('defaultHide'); 1246 ErrorRedirect(result); 1247 } 1248 }); 1249 } 1250 break; 1251 case "update-biodata-upload": 1252 if (CheckBearerHeader()) { 1253 $('#loading-biodata').removeClass('defaultHide'); 1254 $.ajax({
1255 url: apiUrl + '/user/biodata/upload', 1256 type: 'POST', 1257 data: params, 1258 contentType: false, 1259 processData: false, 1260 success: function (result) { 1261 $('#loading-biodata').addClass('defaultHide'); 1262 Update_BiodataUploadResponse(result, errorLabel); 1263 }, 1264 error: function (result) { 1265 $('#loading-biodata').addClass('defaultHide'); 1266 ErrorRedirect(result, errorLabel); 1267 } 1268 }); 1269 } 1270 break; 1271 case "update-request-title": 1272 if (CheckBearerHeader()) { 1273 $('#ajRequestTitleResponseMessage').html('Please wait while we send your request').addClass('alert'); 1274 $('#ajBtnRequestTitle').prop('disabled', true); 1275 setTimeout(function () { $('#ajBtnRequestTitle').prop('disabled', false); }, 5000); 1276 $.ajax({ 1277 url: apiUrl + '/user/personal/request-title?Title=' + params, 1278 type: 'GET', 1279 success: function (result) { 1280 Update_RequestTitle(result); 1281 } 1282 }); 1283 } 1284 break; 1285 case "remove-browser": 1286 $.ajax({ 1287 type: "GET", 1288 url: apiUrl + '/user/browser/remove?BrowserKey=' + $.cookie(params), 1289 contentType: "application/json", 1290 success: function (data) { 1291 if (data) 1292 $.removeCookie(params, { path: '/' }); 1293 }, 1294 error: function (xhr) { 1295 console.error('Remove browser failed:', xhr); 1296 } 1297 }); 1298 break; 1299 case "update-browser": 1300 $.ajax({ 1301 type: "POST", 1302 url: apiUrl + "/user/browser/set", 1303 data: JSON.stringify(params), 1304 contentType: "application/json", 1305 success: function (data) { 1306 if (data) 1307 $.cookie('newbrowserkey', params.BrowserKey, { path: '/', expires: + 365 }); 1308 } 1309 }); 1310 break; 1311 case "register-profile": 1312 $.ajax({ 1313 url: apiUrl + '/registration/finish?SNoKey=' + params, 1314 type: 'GET', 1315 success: function (result) { 1316 RegisterComplete(result); 1317 } 1318 }); 1319 break; 1320 case "temp-login": 1321 $.ajax({ 1322 url: apiUrl + '/registration/authenticate-temp-login?Id=' + encodeURIComponent(params.Id) + '&Password=' + encodeURIComponent(params.Password), 1323 type: 'GET', 1324 success: function (result) { 1325 TempLogin_Result(result, errorLabel); 1326 } 1327 }); 1328 break; 1329 } 1330}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.