Home > Uncategorized > Getting started with Parse

Getting started with Parse

tumblr_inline_mmh9ug8Nil1qz4rgpParse.com is a backend-service for mobile apps, or web apps. It allows you to create simple back ends for mobile apps, without requiring developing your own data-layer. I wanted to try it out, to see if I could get a simple “Hello World” app working, which stores a value in Parse, and then retrieves it via an ID later.

<script src=”http://www.parsecdn.com/js/parse-1.2.8.min.js”></script&gt;
<script src=”http://code.jquery.com/jquery-1.10.1.min.js”></script&gt;
<script language=”javascript”>
Parse.initialize(“…..”, “…..”);
var TestObject = Parse.Object.extend(“TestObject”);
function init()
function save_click()
var testObject = new TestObject();
testObject.save({data: $(“#data”).val()}, {
success: function(object) {
alert(“stored as ” + object.id);
function load_click()
var reference = $(“#reference”).val();
var query = new Parse.Query(TestObject);
query.get(reference, {
success: function(obj) {
error: function(object, error) {
// The object was not retrieved successfully.
// error is a Parse.Error with an error code and description.
<input type=”text” name=”data” id=”data” Value=”hello world”><br>
<input type=”button” value=”save” id=”save”><br>
<input type=”text” name=”reference” id=”reference” Value=””><br>
<input type=”button” value=”load” id=”load”><br>

Here, I initialise the Parse Library, then tie up events via JQuery, the Save and Load buttons to functions save_click and load_click. Save_click then stores a JSON object with property “data” and value as typed into the data text box, and sends this to Parse, all going well, an id is returned and displayed in the “reference” box. Load_click then requests this object again from Parse, using the ID previously provided, and displays the data property into the data text box.


Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: