Skip to content

Instantly share code, notes, and snippets.

@briandoll
Created January 22, 2011 23:21
Show Gist options
  • Save briandoll/791610 to your computer and use it in GitHub Desktop.
Save briandoll/791610 to your computer and use it in GitHub Desktop.
widget.js.erb
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
});
<script src="http://example.com/some/widget/some_key.js"></script>
@panw
Copy link

panw commented May 5, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment