The simple solution would be to use $.getScript(url, callback). However, know that if you insert HTML anywhere in the page using jQuery, it will search for and execute any script tags in that HTML automatically. For example:
$.get('/my/url/with/html_and_jscript.html', function(data) { $("#element").html(data); }); This will place any text returned from the request into #element, but will also scan for and execute any script tags in that returned data. Hope that helps. On Jan 15, 9:41 am, dirk w <dirkwendl...@googlemail.com> wrote: > hello community, > i've got a textfield and a searchbutton. > a click on the searchbutton schould execute the following java script > which will return some data to a callbackfunction called > "showmyvideos": > > $('#searchButton').click(function() > { > var url = 'http://gdata.youtube.com/feeds/api/videos?q='+ > $('#searchText').val() + > '&alt=json-in-script&callback=showMyVideos&max-results=7&format=5'; > > // ajax functions to call $.ajax, $.load, $.get, $.post > EXECUTE('<script type="text/javascript" src="' + url + '"></ > script>'); > > }); > > my problem is: how do i execute this java script line to get the data. > this loading must happen without reloading the whole page. > > is this possible with jquerys ajax plugin? > > thanks a lot in advance! > dirk