function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Steven RokkalaSteven Rokkala 

How to Fix CORS issue on WebToLead

I'm having an issue with the following code. The status of the request is 200 however it doesn't actually send anything because of a CORS issue. I'm aware that I need to add the host URL through the Salesforce platform but is there anything else I need to do since the engineers I've spoken to mentioned that the template code I used to build this form was correct. 
{# Start of Salesforce Form #}
<form class="with-us-form" action="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
<input type=hidden name="oid" value="00D9P000003QZ7w">
<input type="hidden" name="debug" value=1>
<div class="container">
<div class="row">
<div class="col-6">
<div class="row">
<div class="col-6">
<input class="form-control line" type="text" name="first_name" placeholder="First Name*"
required>
</div>
<div class="col-6">
<input class="form-control line" type="text" name="last_name" placeholder="Last Name">
</div>
</div>
</div>
</div>
</div>
</form>

 
SwethaSwetha (Salesforce Developers) 
HI Steven,
Recommend checking similar scenarios https://salesforce.stackexchange.com/questions/335060/what-does-same-origin-policy-mean-when-trying-to-submit-a-web-to-lead-form-via-a

https://salesforce.stackexchange.com/questions/162265/cors-whitelisting-not-working-as-expected

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you