[Pkg-javascript-commits] [backbone] 09/34: Using JSONP since the Same Origin Policy won't let file:// make an XHR to github.com
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 16:58:52 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.2.0
in repository backbone.
commit 349878cdf85b9b1e5f2c8d8fbc6881482dd26f90
Author: Nick Fitzgerald <fitzgen at gmail.com>
Date: Mon Oct 18 21:36:05 2010 -0700
Using JSONP since the Same Origin Policy won't let file:// make an XHR to github.com
---
demos/gist.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/demos/gist.js b/demos/gist.js
index 46b5a3c..532e033 100644
--- a/demos/gist.js
+++ b/demos/gist.js
@@ -24,9 +24,14 @@ var GistApp = Backbone.View.extend({
var GithubAccount = Backbone.Model.extend({
initialize : function() {
- $.getJSON(this.url(), {}, _.bind(function(resp) {
- this.set(resp.user);
- }, this));
+ var me = this;
+ $.ajax({
+ url : me.url(),
+ dataType : "jsonp",
+ success : function (data, status, xhr) {
+ me.set(data.user);
+ }
+ });
},
url : function() {
@@ -45,7 +50,6 @@ var AccountView = Backbone.View.extend({
},
render : function() {
- console.log(this.model);
var ui = $('#accountTemplate').tmpl({account : this.model});
$(this.el).html(ui);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git
More information about the Pkg-javascript-commits
mailing list