{"id":1716,"date":"2025-10-22T14:21:23","date_gmt":"2025-10-22T14:21:23","guid":{"rendered":"http:\/\/gogetmuscle.com\/?p=1716"},"modified":"2025-10-22T17:46:25","modified_gmt":"2025-10-22T17:46:25","slug":"forbidden-error","status":"publish","type":"post","link":"http:\/\/gogetmuscle.com\/index.php\/2025\/10\/22\/forbidden-error\/","title":{"rendered":"Forbidden Error"},"content":{"rendered":"

When I using form.create method, The form is loaded but my custom JS code is not working as expected. I can only see 403 forbidden error in my console.\u00a0<\/P>

\u00a0<\/P>

The code assiciated with functions are not triggering .<\/P>

hbspt<\/SPAN>.<\/SPAN>forms<\/SPAN>.<\/SPAN>create<\/SPAN>({<\/SPAN><\/DIV>
\u00a0 <\/SPAN>region<\/SPAN>:<\/SPAN> “na1”<\/SPAN>, \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/SPAN><\/DIV>
\u00a0 <\/SPAN>portalId<\/SPAN>:<\/SPAN> “123456”<\/SPAN>, \u00a0 \u00a0 \u00a0 \u00a0 <\/SPAN><\/DIV>
\u00a0 <\/SPAN>formId<\/SPAN>:<\/SPAN> “abcdef-1234…”<\/SPAN>, \u00a0 <\/SPAN><\/DIV>
\u00a0 <\/SPAN>target<\/SPAN>:<\/SPAN> “#form-container”<\/SPAN>, \u00a0<\/SPAN><\/DIV>
\u00a0 <\/SPAN>\/\/ Events<\/SPAN><\/DIV>
\u00a0 <\/SPAN>onFormReady<\/SPAN>:<\/SPAN> function<\/SPAN>(<\/SPAN>$form<\/SPAN>) {<\/SPAN><\/DIV>
\u00a0 \u00a0 <\/SPAN>alert<\/SPAN>(<\/SPAN>‘Form is ready’<\/SPAN>);<\/SPAN><\/DIV>
\u00a0 },<\/SPAN><\/DIV>
\u00a0 <\/SPAN>onFormSubmit<\/SPAN>:<\/SPAN> function<\/SPAN>(<\/SPAN>$form<\/SPAN>) {<\/SPAN><\/DIV>
\u00a0 \u00a0 <\/SPAN>alert<\/SPAN>(<\/SPAN>‘Form is ready to submit’<\/SPAN>);<\/SPAN><\/DIV>
\u00a0 },<\/SPAN><\/DIV>
\u00a0 <\/SPAN>onFormSubmitted<\/SPAN>:<\/SPAN> function<\/SPAN>(<\/SPAN>$form<\/SPAN>) {<\/SPAN><\/DIV>
\u00a0 \u00a0 <\/SPAN>alert<\/SPAN>(<\/SPAN>‘Form is submitted’<\/SPAN>);<\/SPAN><\/DIV>
\u00a0 }<\/SPAN><\/DIV>
});<\/SPAN><\/DIV><\/DIV><\/p>\n","protected":false},"excerpt":{"rendered":"

When I using form.create method, The form is loaded but my custom JS code is not working as expected. I can only see 403 forbidden error in my console.\u00a0\u00a0The code assiciated with functions are not triggering .hbspt.forms.create({\u00a0 region: “na1”, \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 portalId: “123456”, \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 formId: “abcdef-1234…”, […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[],"_links":{"self":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts\/1716"}],"collection":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/comments?post=1716"}],"version-history":[{"count":1,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts\/1716\/revisions"}],"predecessor-version":[{"id":1717,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts\/1716\/revisions\/1717"}],"wp:attachment":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/media?parent=1716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/categories?post=1716"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/tags?post=1716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}