Created
January 22, 2011 23:21
-
-
Save briandoll/791610 to your computer and use it in GitHub Desktop.
widget.js.erb
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.write("<div id='our-awesome-widget-target'></div>"); | |
var receivedForm = function(data) { | |
$("#our-awesome-widget-target").html(data["html"]); | |
} | |
$.ajax({ | |
url: 'http://example.com/something/<%= @some_key %>.json', | |
dataType: 'jsonp', | |
success: receivedForm | |
}); |
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
<script src="http://example.com/some/widget/some_key.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the tutorial Brian. I wrote a controller to redirect to widget.js.erb, but the Chrome browser gives me a Error 310 - too many redirects. Sorry to bother you with a question, but could you give me some suggestions on how do could get widget.js.erb to run? Thanks