Quantcast
Channel: Rick Schott :: devlpr.net » AJAX
Viewing all articles
Browse latest Browse all 10

How to get script tags with jQuery .find from ajax result

$
0
0
$.ajax({
    type: "GET",
    dataType: 'html',
    contentType: 'application/x-www-form-urlencoded',
    url: '/url',
    success: function (data) {
        //have to replace script or else jQuery will remove them
        var parsedHTML = data.replace(/script/gi, 'rickscript');  
        $(parsedHTML).find('rickscript').each(function (index, domEle) {
            if (!$(this).attr('src')) {
                eval($(this).text()); //feeling lucky execute it
            }
        });
    }
});

Viewing all articles
Browse latest Browse all 10

Trending Articles