I’m working on a website built with ExpressionEngine and I have an HTML contact form that currently submits data to the EE database. Now I need to modify it so the same form data gets sent to HubSpot’s API as well.
I want to keep the original ExpressionEngine form submission working while also sending the data to HubSpot. I think jQuery and AJAX might be the solution but I’m not sure how to implement this properly. Any suggestions would be helpful!
you can use js to catch the form submit event. call preventDefault() to stop the default action, then use fetch/ajax to send data to hubspot first. once that’s done, you can submit to expressionengine. this will keep your ee process intact.
Build a middleware layer between your form and both systems. I hit the same issue with multiple CRMs and learned that a dedicated endpoint beats modifying existing handlers every time. Create a PHP script that grabs your form data and fires off parallel requests to ExpressionEngine and HubSpot using cURL multi handles. Running them concurrently instead of one-after-the-other cuts your response time way down. Best part? You control error handling for each system separately. HubSpot craps out? Your EE submission still goes through. You can retry failed HubSpot calls without users ever knowing something went wrong. Just point your form action to this new script instead of hitting EE directly. It handles the dual submission behind the scenes while users get the same experience whether one service is having a bad day or not.
ajax form submit works but it’s messy. just use hubspot’s native form embed and hook it to ee through zapier. way cleaner - everything stays synced automatically and you don’t have to deal with failed requests breaking stuff.
Handle this server-side in your ExpressionEngine form processor instead of client-side. Modify your EE form handler to call the HubSpot API right after processing the EE submission successfully. Either create a custom extension or add your HubSpot cURL code to your existing form handler. The form submits to EE normally, processes the data, saves to your database, then immediately hits HubSpot in the background. Your main form keeps working even if HubSpot’s API goes down or runs slow. You can log HubSpot errors without breaking anything for users. I’ve done this on several EE sites - works great. Users see their EE confirmation page while HubSpot updates behind the scenes.
I’ve handled dual submissions like this for years. These suggestions work, but they overcomplicate things.
Keep your EE form exactly as-is and handle HubSpot separately. No code changes, no breaking what works.
Set up a webhook listener that catches EE submissions instantly. Someone submits → EE processes normally → webhook triggers → data gets reformatted and pushed to HubSpot.
Best part? Users never wait for HubSpot. They get their EE confirmation immediately while HubSpot updates in the background. HubSpot slow or down? Nobody notices because your main flow keeps running.
I’ve connected hundreds of forms this way. Takes 10 minutes with built-in retry logic and error monitoring. Way more reliable than juggling two APIs in one request.
Your EE form stays exactly the same. Zero changes.
There’s a cleaner way to handle this without preventDefault and complex AJAX chains.
I’ve done similar multi-platform integrations before. The JavaScript approach adds client-side dependencies and failure points. What if JS is disabled or there’s a network issue?
Let your form submit normally to ExpressionEngine, then use automation for the HubSpot part. Set up a webhook in your EE form handler that triggers on new submissions.
The webhook instantly pushes that data to HubSpot’s API while your original EE flow runs unchanged. Both systems get the data reliably, you don’t modify existing form logic, and if one system goes down it doesn’t break the other.
You can build this webhook automation in minutes instead of writing custom PHP integrations. Plus you get error handling, retry logic, and monitoring built in.
I’ve used this pattern for connecting dozens of platforms and it’s way more reliable than client-side solutions.