jquery - In an AJAX update, how can I access code from an external javascript file? -
i'm learning ruby on rails , i'd utilize unobtrusive javascript display modal. when user clicks on remote link, calls action in 1 of controllers returns next javascript...
var sm = new simplemodal({"width":600}); sm.addbutton("action button", "btn primary", function(){ this.hide(); }); sm.addbutton("cancel", "btn"); sm.show({ "model":"modal-ajax", "title":"title", "param":{ "url":"/ajax/url", "onrequestcomplete": function(){ /* action on request finish */ } } });
...but problem code doesn't know simplemodal since that's defined in separate javascript file. how can import or reference simplemodal code ajax update can create simplemodal object , show it?
thanks in advance wisdom!
require simple modal in application.js application wide use
//= require simple_modal
javascript jquery ruby-on-rails ajax simplemodal
No comments:
Post a Comment