JavaScript
Install Parse SDK
12 min
install parse sdk to your javascript project introduction in this section, you learn how to install parse javascript sdk into your html project see more about parse sdk at parse javascript sdk api reference and parse open source documentation for javascript sdk prerequisites to complete this tutorial, you will need an app created at back4app follow the new parse app tutorial to learn how to create a parse app at back4app parse javascript sdk supports firefox 23+, chrome 17+, safari 5+, and ie 10 ie 9 is supported only for apps that are hosted with https 1 install sdk to enable the parse javascript sdk in your web app, create a new index html index html file or use your main html file and add the following script inside its \<head> \<head> tag index html 2 connect your parse app initialize your parse app before using any parse functionality, you need to call the parse initialize parse initialize method to set up the authentication token and connect your page with back4app servers in your index html index html file, create a \<script> \<script> tag at the bottom of it and add the following code index html note that creating and importing a separate javascript file is strongly advised instead of using inline js code in your html file, but for simplicity, we will use the latter here find your application id and your client key go to your app dashboard at the back4app website navigate to app settings click on server settings server settings > core settings core settings block> settings settings return to your parse initialize parse initialize function and paste your applicationid applicationid and javascriptkey javascriptkey there 3 testing your connection create a test code test your initial setup with the following code which creates a new object of the user class add it inside the \<script> \<script> tag, right after the parse initialize parse initialize method index html // create a new user async function createparseuser() { // creates a new parse "user" object, which is created by default in your parse app let user = new parse user(); // set the input values to the new "user" object user set("username", document getelementbyid("username") value); user set("email", document getelementbyid("email") value); user set("password", document getelementbyid("password") value); try { // call the save method, which returns the saved object if successful user = await user save(); if (user !== null) { // notify the success by getting the attributes from the "user" object, by using the get method (the id attribute needs to be accessed directly, though) alert( `new object created with success! objectid ${ user id }, ${user get("username")}` ); } } catch (error) { alert(`error ${error message}`); } // add on click listener to call the create parse user function document getelementbyid("createbutton") addeventlistener("click", async function () { createparseuser(); }); you also need to create the input fields to pass data to your javascript function, so add these plain elements to your \<body> \<body> section of your html file index html js sdk create user go ahead and test this example app following these steps open your html file in your web browser fill the input fields with data and click; an alert box will show the id of the new user object that was created login at back4app find your app and click on dashboard click on core core go to browser browser click on user user class check your new object there after these steps you should see something like this here is the full app code index html js sdk create user it’s done! at this point, you have learned how to get started with javascript web apps learn more by reading the parse open source documentation for javascript sdk