Getting CORS error when trying to submit a post call from Angular application

  • Profile Image
    shanssr7
    Asked on August 13, 2025 at 3:52 PM

    Hi,

    I'm getting CORS error when trying to submit a post call from Angular application.

    Access to XMLHttpRequest at 'https://Mydomain.jotform.com/api/form/256661636732048/submissions?...' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource..


    Please guide us in resolving the issue.


    Thank you

  • Profile Image
    Podo: Support AI Agent
    Replied on August 13, 2025 at 3:52 PM

    Hi Shan,

    I'm an AI assistant. I'll do my best to help you until someone from the support team is available.

    Regarding the CORS error you're encountering when submitting a POST call from your Angular app to the Jotform API, there is no specific information available in our knowledge base about resolving this issue directly.

    Typically, CORS errors occur because the server (Jotform API) does not allow requests from your localhost origin. This is a security feature enforced by browsers.

    To work around this, you might consider using a backend server to make the API call or check if Jotform API supports CORS for your use case. You can also ensure your request headers and method comply with Jotform API requirements.

    Let us know if you have any other questions.

    Best regards,
    Jotform Support

  • Profile Image
    Ronald JotForm Support
    Replied on August 13, 2025 at 4:27 PM

    Hi Shan,

    Thanks for reaching out to Jotform Support. Can you share the exact API request you made so we can check on it? This will help us check if it’s structured correctly and if there’s anything in the request that could be triggering the error. You can also refer to the API Documentation to learn more about it.

    After we hear back from you, we’ll have a better idea of what’s going on and how to help.

  • Profile Image
    shanssr7
    Replied on August 13, 2025 at 4:47 PM

    Hi Ronald,

    Thanks for your response. Its a simple request.

    url: https://Mydomain.jotform.com/api/form/256661636732048/submissions

    Request body:

    {[patientname, Test]}.


    I tried the same call from C# backend. Getting 400 Bad request error.

    Thank you




  • Profile Image
    shanssr7
    Replied on August 13, 2025 at 5:06 PM

    Hi Ronald,


    After changing the request as below, able to submit successfully and a row is created in the table, but the values are not updated.

    {"submission[PATIENTNAME]", "Test" }


    Am I missing anything here.


    Thank you

  • Profile Image
    Kyle JotForm Support
    Replied on August 13, 2025 at 5:48 PM

    Hi Shan,

    For the field values to update correctly, the keys in your POST body must exactly match your form field names as defined in the Jotform API. You can check the correct field names by calling the GET /form/{id}/questions endpoint, this will return the question IDs and names you should use in your request.

    GET https://api.jotform.com/form/256661636732048/questions?apiKey=YOUR_API_KEY

    You can review our full API documentation here.

    Give it a try and reach out again if you have any other questions.