in Education by
I'm using $.ajax() to load new pages on my site if certain conditions are met (a flash-based radio player being active). However, I'd prefer not to modify the server-side output for this case. Now I need a way to embed both the response on my page (that's easily done using .replaceWith()) but also execute javascripts embedded on this page. One thought I had was creating a dummy div like
but maybe there's a better way that doesn't require changing my html code (i.e. a pure js/jquery solution). Note that using $(elem).load() is not possible as it does not evaluate any scripts if only a fragment of the retrieved document is used: // inject the contents of the document in, removing the scripts // to avoid any 'Permission Denied' errors in IE I don't know any details about this IE problem but of course whatever code you are going to suggest should not cause errors in recent IE versions (I don't care about IE6). JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Something along the lines of: $('container').html(text_from_ajax_request); $('container script').each(function(){ var $this = $(this); src = $this.attr('src'); src ? $.getScript(src) : eval($(this).text()); });

Related questions

0 votes
    I have the following Javascript code which controls an accordion type set of divs. The set of divs is ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    How can I sort an event by id in DESC order? My all events are coming and by default they are ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 26, 2022 in Education by JackTerrance
0 votes
    How can I sort an event by id in DESC order? My all events are coming and by default they are ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have a field as Image. I want to set it compulsory on button click event in javascript. Hereis ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    Good afternoon. What happens that I want to get a text string with HTML tags, but the summernote interprets ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    I'm trying to make it so when a user scrolls down a page, click a link, do whatever it is they ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    $(document).ready(function(){ alert("funciton"); $(function(){ $.fn.gotof(){ alert("I am ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    $(document).ready(function(){ alert("funciton"); $(function(){ $.fn.gotof(){ alert("I am ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    $(document).ready(function(){ alert("funciton"); $(function(){ $.fn.gotof(){ alert("I am ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I've a datepicker, using jQuery. But I want to substract 5 days from the date that is selected ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    I've a datepicker, using jQuery. But I want to substract 5 days from the date that is selected ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    Please refer to my test case https://jsfiddle.net/1c3Lmace/13/ This is my code $(document).ready( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have loop inside loop like this: var len = bolumlerUnique.length; function bolumleriGonder() { for (i ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 27, 2022 in Education by JackTerrance
0 votes
    I have loop inside loop like this: var len = bolumlerUnique.length; function bolumleriGonder() { for (i ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    I have loop inside loop like this: var len = bolumlerUnique.length; function bolumleriGonder() { for (i ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 14, 2022 in Education by JackTerrance
...