This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-var events = _.clone(Backbone.Events); | |
- | |
var Status = Backbone.Model.extend({ | |
url: '/status' | |
}); | |
-var Statuses = function() { | |
-}; | |
-Statuses.prototype.add = function(text) { | |
- var status = new Status(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('form').bind('submit', function() { | |
alert('User submitted form'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$('#new-status').submit(function(e) { | |
e.preventDefault(); | |
$.ajax({ | |
url: '/status', | |
type: 'POST', | |
dataType: 'json', | |
data: { text: $(this).find('textarea').val() }, | |
success: function(data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Status = Backbone.Model.extend({ | |
url: '/status' | |
}); | |
var Statuses = Backbone.Collection.extend({ | |
model: Status | |
}); | |
var NewStatusView = Backbone.View.extend({ | |
events: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Status = Backbone.Model.extend({ | |
url: '/status' | |
}); | |
var Statuses = Backbone.Collection.extend({ | |
model: Status | |
}); | |
var NewStatusView = Backbone.View.extend({ | |
+ events: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Status = Backbone.Model.extend({ | |
url: '/status' | |
}); | |
var Statuses = Backbone.Collection.extend({ | |
model: Status | |
}); | |
var NewStatusView = Backbone.View.extend({ | |
- initialize: function(options) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Status = Backbone.Model.extend({ | |
url: '/status' | |
}); | |
var Statuses = Backbone.Collection.extend({ | |
- add: function(text) { | |
- var that = this; | |
- var status = new Status(); | |
- status.save({ text: text }, { | |
- success: function(model, data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var events = _.clone(Backbone.Events); | |
+var Status = Backbone.Model.extend({ | |
+ url: '/status' | |
+}); | |
+ | |
var Statuses = function() { | |
}; | |
Statuses.prototype.add = function(text) { | |
- $.ajax({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var events = _.clone(Backbone.Events); | |
var Statuses = function() { | |
}; | |
Statuses.prototype.add = function(text) { | |
$.ajax({ | |
url: '/status', | |
type: 'POST', | |
dataType: 'json', | |
data: { text: text }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var events = _.clone(Backbone.Events); | |
var Statuses = function() { | |
}; | |
Statuses.prototype.add = function(text) { | |
$.ajax({ | |
url: '/status', | |
type: 'POST', | |
dataType: 'json', | |
data: { text: text }, |