You just learned the magical AJAX-y ease of working with a Backbone model. Now it's your turn to implement a backbone model that you can persist.
- Use
Backbone.Model.extend()
to create a new constructor function calledFootSoldier
.
- Note: there are a number of FootSoldier's in the database. For now, let's assume we're only interested in the
FootSoldier
with id of 1.
- Using your new constructor function, instantiate the
FootSoldier
. - Use Backbone's convenient
.fetch()
to retrieve theFootSoldier
's data via ajax. - Examine the foot soldier's
image_url
andheight_in_inches
attributes using.get()
- Change the foot soldier's
image_url
to a strange photo you find on the internet. - Use Backbone to persist the changes to the database.