[
{
"dateSearched": "1986-10-15T07:00:00.000Z",
"city": "Phoenix",
"agency": "phoenix police",
"outcome": "Killed",
"shots": null,
"victim": {
"name": "David Valenzuela",
"age": "24",
"gender": "Male"
}
},| class | credits | first_name | last_name | major |
|---|---|---|---|---|
| info343 | 5 | Alan | Martinez | Sociology |
| info343 | 5 | Beth | Kursh | History |
| info344 | 4 | Negin | Dahl | Math |
| info344 | 4 | Alan | Martinez | Sociology |
| class_id | credits |
|---|---|
| info343 | 5 |
| info344 | 4 |
| student_id | first_name | last_name | major |
|---|---|---|---|
| 987249 | Alan | Martinez | Sociology |
| 242434 | Beth | Kursh | History |
cd Desktop/parse-intro
python -m SimpleHTTPServer 8080
# See page at localhost:8080<script src="//www.parsecdn.com/js/parse-1.6.0.min.js"></script>
Parse.initialize("application-id", "javascript-key");var ToDo = Parse.Object.extend('ToDo')var toDoItem = new ToDo()// Initialize app
// Create a new sub-class of the Parse.Object, with name "Music"
// Create a new instance of your Music class toDoItem.set('importance', 'high')toDoItem.get('importance') // returns 'high'toDoItem.save()toDoItem.save(null, {
success: function(todo) {
// Execute any logic after the object is saved.
alert('New object created with objectId: ' + todo.id);
},
error: function(todo, error) {
// Execute any logic that should take place if the save fails.
alert('Failed, with error code: ' + error.message);
}
});// Create a new sub-class of the Parse.Object, with name "Music"
// Create a new instance of your Music class
// Set a property 'band' equal to a band name
// Set a property 'website' equal to the band's website
// Set a property 'song' equal to a song
// Save your instance of your song -- and go see it on parse.com!
// Click event when form is submitted
$('form').submit(function() {
// Create a new instance of your Music class
/* For each input element, set a property of your
new instance equal to the input's value */
/* After setting each property,
save your new instance back to your database */
return false
})var query = new Parse.Query(ToDo);query.equalTo('importance', 'high')query.find({
success:function(results) {
// Do something with your array of results
}
})// Write a function to get data
var getData = function() {
// Set up a new query for our Music class
/* Set a parameter for your query --
where the website property isn't missing */
/* Execute the query using ".find". When successful,
pass the returned data into your buildList function
*/
}// A function to build your list
var buildList = function(data) {
// Empty out your unordered list
/* Loop through your data, and
pass each element to the addItem function */
}// This function takes in an item, adds it to the screen
var addItem = function(item) {
/* Get parameters (website, band, song)
from the data item passed to the function */
// Append li that includes text from the data item
/* Time pending, create a button that removes the
item on click */
}CRUD Challenge (due next week)