jQuery(document).ready(function($) {
$(document).on('click', '#download-vcf-button', function(e) {
e.preventDefault();
var $this = $(this); // Cache the button element
var userId = $this.data('user-id');
// Show loading indicator
$this.text('Downloading...'); // Change button text
$this.prop('disabled', true); // Disable the button
if (!userId) {
console.error('User ID not found.');
displayErrorMessage('Error: User ID not found.'); // Call our error display function
resetButtonState($this); // Reset the button
return;
}
$.ajax({
url: vcf_download_vars.ajax_url,
type: 'POST',
data: {
action: 'generate_vcf',
user_id: userId,
nonce: vcf_download_vars.nonce
},
success: function(response) {
if (response.success === false) {
// Handle PHP errors sent as JSON
console.error('Error generating VCF:', response.data);
displayErrorMessage('Error: ' + response.data); // Display the specific error message
} else {
// Create a temporary link element for download
var link = document.createElement('a');
link.href = 'data:text/vcard;charset=utf-8,' + encodeURIComponent(response);
link.download = 'consultant-' + userId + '.vcf';
// Append, trigger click, and remove the link
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('AJAX Error:', textStatus, errorThrown);
displayErrorMessage('Error: Could not generate VCF. Please try again later.');
},
complete: function() {
resetButtonState($this); // Reset the button in all cases (success or error)
}
});
});
// Function to display error messages (you can customize this)
function displayErrorMessage(message) {
// Example: Display the message in a div with the ID "error-message"
$('#error-message').text(message).show();
// Optional: Use a nicer alert library like SweetAlert
// Swal.fire({
// icon: 'error',
// title: 'Error',
// text: message,
// });
}
// Function to reset the button to its original state
function resetButtonState($button) {
$button.text('Download VCF'); // Reset text
$button.prop('disabled', false); // Re-enable button
}
});
“After I retired, I worried about my savings running out. Now, I depend on my investments – they provide a steady monthly income, letting me enjoy my golden years without financial stress.”
Retirement Planning Got You Stressed?
Juggling a busy career and planning for retirement can feel overwhelming. You’re not alone if you:
Can't squeeze retirement planning into your packed schedule?
Ignoring retirement planning can have serious consequences
Imagine this: It’s 10 years from now. You’re finally free from the daily grind, ready to embrace a life of leisure, travel, and cherished moments with loved ones.
But instead of feeling relaxed and fulfilled, you forgot to factor in rising healthcare costs, and now your savings are dwindling.
You’re burdened with financial worries, wondering if your savings will last.
Inflation can silently erode your savings. What seems like a comfortable nest egg today may not cover your future expenses.
We'll help you develop a customized retirement strategy that outpaces inflation, so you can enjoy your dream lifestyle with confidence.
Your Retirement, Your Way
Your retirement should be as unique as you are.
Invest wisely based on your individual goals, not trends. Define what “enough” means for YOUR lifestyle, not someone else’s. And most importantly, design your days around what brings YOU joy, whether it’s travel, hobbies, or simply relaxing at home.
Ready to break free from the ordinary and create a retirement that’s uniquely yours?
Average retail prices for noodle-based cooked food items/ Image Credit: SingStat
Don't Let Inflation Burst Your Retirement Bubble
Inflation is a silent retirement killer. What seems like a comfortable nest egg today may not cover your expenses in the future.
Planning for rising costs is crucial to ensuring your retirement lifestyle remains within reach. Let us help you develop a strategy to outpace inflation and protect your purchasing power.
Inflation is a silent retirement killer. What seems like a comfortable nest egg today may not cover your post-retirement expenses or weekend staycations in the future.
Planning for rising costs in Singapore is crucial. Let’s develop a strategy to outpace inflation and ensure your retirement lifestyle remains within reach.
I have read and understood FAPL’s Personal Data Policy, and hereby give my acknowledgement and consent to FAPL to use my personal data in accordance with FAPL’s Personal Data Policy.
I have read and understood the disclaimers above and hereby affirm my acceptance of these terms.
我已阅读并理解了上述免责声明,特此声明接受这些条款。
I have not been directly contacted or approached by any representative or employee of FAPL with an offer or solicitation to apply for any financial products not offered in my home country.
Financial Alliance Pte Ltd ( “FAPL”) is licensed by the Monetary Authority of Singapore (“MAS”) and allowed to conduct financial advisory activities in accordance with the Financial Advisers Act (Cap. 110) (“FAA”) and the Securities & Futures Act (Cap. 289) (“SFA”) within the jurisdiction of the Republic of Singapore and in accordance with the licenses granted by MAS
Any services provided by FAPL to persons not ordinarily resident in Singapore are provided solely on an offshore basis from Singapore, resulting from direct enquiry on the part of the foreign residents.
鑫盟理财为非新加坡居民所提供的任何服务仅限于直接向鑫盟理财发出咨询请求的国外居民。
As an integral part of the provision of such services, FAPL may from time to time make available to such residents, documents and information making reference to capital markets products (for example, in connection with the provision of fund management or investment advisory services outside of the foreign jurisdiction).
Such documents and information are provided by Financial Alliance Pte Ltd (“FAPL”) is for general information only and is not intended for anyone other than the recipient.
此类由鑫盟理财所提供的文件和信息仅供收件人做一般信息参考。
It does not take into account the specific investment objectives, financial situation or particular needs of any particular person.
此类文件和信息不会把-个人投资目标,财务状况或其特定需求等考虑在内。
It does not constitute the making available of, or an offer or solicitation by FAPL to buy or sell or subscribe for any such capital markets product or to enter into a transaction or to participate in any particular trading or investment strategy nor an advice or a recommendation with respect to such financial products.
These documents may not be published, circulated, reproduced or distributed in whole or in part to any other person without FAPL’s prior written consent.
未经鑫盟理财的事先书面同意,不得将这些文件全文或部分发布,传播,复制或分发给其他人。
This document is not intended for distribution to, publication or use by any person in any jurisdiction, where such distribution, publication or use would be contrary to applicable law or would subject FAPL and its related corporations, connected persons, associated persons and/or affiliates to any registration, licensing or other requirements within such jurisdiction.
You shall ensure that you have and will continue to be fully compliant with all applicable laws in your home country when entering into discussion or contracts with FAPL.
In compliance with the Personal Data Protection Act, Financial Alliance Pte Ltd (“FAPL”) seek your consent to collect and use your personal data (e.g. name, NRIC, contact numbers, mailing addresses, email addresses and photograph) for the purposes of and in accordance with FAPL’s Data Protection Policy, which can be found on FAPL’s website at https://fa.com.sg/data-protection-policy/.
Subscribe to our newsletter to receive updates on our latest content!
By providing the info below, I confirm that I am the user and/or subscriber of the telephone number(s) and email address provided by me and I consent to receive from Financial Alliance and/or its financial adviser representatives, any marketing, advertising and promotional information organise by Financial Alliance via voice calls, SMS/MMS (text messages) or faxes to my telephone number(s) provided below. I understand I may withdraw any consent I have given at any time by writing in to Financial Alliance Pte Ltd.