APIs & Integrations

aemmi
Participant

Receiving failed to load when call form API

I'm calling the forms API with straight JavaScript. I receive the error Failed to load with the URL supplied. The URL is correct as it tries to redirect to the redirect page in the form. How can I find out why the form failed to load. Is PHP, C#, VB and NodeJS the only methods that you can use to call the forms API?

This is the only parameter I'm passing at this time {"email":"ae@gaylord.com"}

0 Upvotes
6 Replies 6
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Receiving failed to load when call form API

Hi @bds9487,

Check out the following stack overflow topic:

301 or 302 Redirection With PHP

php

0 Upvotes
aemmi
Participant

Receiving failed to load when call form API

Thank you for your prompt response. I am receiving a 302 status code. I will now be able to make the necessary changes

Angelo

Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Receiving failed to load when call form API

Hi @aemmi,

When the form submissions is successful and a redirectUrl is included or set in the form settings , the response upon submission should be a 302. You can then pass this along to the client to redirect them to the correct URL.

0 Upvotes
bds9487
Member

Receiving failed to load when call form API

Derek,

I'm getting a 302 error when using the php form submission. Can you tell me how to fix it. How would I pass this to the client as you mention above?

0 Upvotes
aemmi
Participant

Receiving failed to load when call form API

Derek ,

Thank you for your response. I was attempting to make the call from the client side using JavaScript within a JSP page. I have switched to making the call from a PHP page on the server side and I have been successfully in making the call.

One other question after successfully making the call to the HUBSPOT form, does the HUBSPOT form redirects the page that is supplied in the form or does it just pass back the redirected link

Thank You

Angelo

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Receiving failed to load when call form API

Hi @aemmi,

The Forms API is platform-agnostic, but it doesn't support CORS AJAX, so if you're trying to submit forms client-side then you'd see a CORS error. If not, can you send me the raw error you're seeing, and also the full request you're making to the forms API?

0 Upvotes