Skip to content

Commit

Permalink
Merge pull request #7 from dcartoon/master
Browse files Browse the repository at this point in the history
Adding Cross-Domain support via JSONP
  • Loading branch information
jondot committed Apr 22, 2012
2 parents e25b93d + 6aa6fd2 commit e7082ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions app/js/graphene.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,19 @@ class Graphene.GraphiteModel extends Backbone.Model
clearInterval(@t_index)

refresh: ()=>
d3.json @get('source'),
(js) =>
url = @get('source')
#jQuery expects to see 'jsonp=?' in the url in order to perform JSONP-style requests
if -1 == url.indexOf('&jsonp=?')
url = url + '&jsonp=?'

options =
url: url
dataType: 'json'
jsonp: 'jsonp'
success: (js) =>
console.log("got data.")
@process_data(js)
$.ajax options

process_data: ()=>
return null
Expand Down
Loading

2 comments on commit e7082ea

@mromaine
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I ended up pulling from dcartoon's branch, but glad to see this request fulfilled!

@jondot
Copy link
Owner Author

@jondot jondot commented on e7082ea Apr 23, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem!

Please sign in to comment.