Unable to update database from Live Site

I have a form to add new entries to my database. The form works fine when used in Sandbox environment and the database is getting updated. Whereas, in the live environment, the entries are not getting added to the database.

I’m getting the following error in the console

Similarly, I have implemented a visit counter on my dynamic page. The counter value in the database gets updated whenever a user opens the page. The counter value in the database is getting updated in the sandbox environment but not getting updated in the live environment.

I’m getting the following error in the console.

Kindly help me with it!

Check the collection permissions.

Yes, it works after having updated the collection permission to ‘Anyone’. Thank you!