Basically, the problem is this here: $(document).ready(function(){ You wrapped it inside an event that will only fire when the document throws its ready event. If you include the script after the page is loaded, regardless from where, th event will never fire. If you remove the "$(document).ready(function(){" wrapper from script.js (called via getScript), it will work a lot easier.
I've done a small snippet which does javascript backloading, which includes js files after the page has loaded. Worst case, it should still give you some idea of how to use a callback with getScript to fire a defined function within the script.js file. http://snipplr.com/view/10368/jquery-automatic-script-includer/ On Feb 4, 9:32 am, pere roca <pero...@gmail.com> wrote: > hi Eric, > > I don't understand what you mean... > the functions in script.js (called via getScript) work if I call > $.getScript but I wanna call these functions from outside (after script is > loaded), so I can pass some parameter to the functions that are inside > script.js. > $.getScript is not called when the page is loaded (I think that's what > you mean). I'm firing it via Firebug console. > > thanks, > Pere > > > > Eric Garside wrote: > > > If you call $.getScript after your regular scripts are already loaded, > > domready will not fire again. > > > On Feb 4, 8:16 am, pere roca <pero...@gmail.com> wrote: > >> hi all, > >> if I'm not wrong we cannot send parameters to a script called by > >> getScript > >> function; > >> so, if we "download" or get the script and then we call a function inside > >> the script, shouldn't it work? the function is there, now in our > >> browser... > >> but doesn't work. > > >> $.getScript('script.js'); x("ssss"); > > >> script.js: > >> $(document).ready(function(){ > >> //x function is declared as global > >> x=function(datas) > >> { > >> alert(datas) > > >> }; > >> }) > > >> Thanks!! > >> -- > >> View this message in > >> context:http://www.nabble.com/getscript-without-parameters...-an-alernative--... > >> Sent from the jQuery General Discussion mailing list archive at > >> Nabble.com. > > -- > View this message in > context:http://www.nabble.com/getscript-without-parameters...-an-alernative--... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.