Hi Stan,
What do you mean by using the REST API?
You should never add a REST API call on a client-side code. As it contains connection info to you Marketo REST API end point, it will enable any one to use it and saturate your REST API, with both the risk to populate you DB with *** data (Marketo won't control it) and also create a DOS when the 10000 calls a day will be reached.
What you can do instead is use another type of form (such as the form system from your CMS) which will post the data to your web back-end, from which you can call the REST API to insert/update the lead in Marketo. You will also need to capture the Marketo cookie value and run a REST API associate Lead. This method will have a drawback : you will not be able to capture the "fills out form" event and it will not be possible to prefill the form with Marketo values.
-Greg