Need to make a ajax call to fetch and send data on Website Page


#1

Hi All,

I need help on this functionality. The description is below.

We need to fetch or send data to JSON on ajax call on a button click.
This button we have in website pages(a module in Design Manager Template).
Is there any possibility we can achieve this.
We need to import a csv file to MySQL then do ajax call(javascript) to some backend code(PHP, .net, java etc).

Please suggest ideas to achieve this.
Any help will be appreciated!!

Thanks in Advance!!


#2

Hi @Satyam,

Just to make sure that we’re on the same page, are you trying to make a call to an external server on a button click? The HubSpot CMS supports JavaScript, so you can add a script to the page/template you’re referring to to make the relevant requests.


#3

Thanks a lot Derek for replying,

Actually, I am still searching for options to achieve this in Hubspot. Whichever way is easier and can be achieved in less time is preferable. If we can achieve this through external server then please help me how we can do it. Please guide me in detail. I will be obliged.


#4

Hi @Satyam,

I’m sorry, I’m still trying to understand what your goal is. If you need to send information via AJAX when a button is clicked, you can target the button and trigger a function when it’s clicked using jQuery’s .click() function (https://api.jquery.com/click/).

I’m not entirely clear on what you’re looking to do regarding the CSV import to your MySQL server, though. Can you provide some more context on what exactly you’re looking to do?