I've included a script in jQuery, but it doesn't seem to work. Can you take a look at the code and enlighten me?
<div id="foo"></div>
$('#foo').append('<script> some code </script>');
I've included a script in jQuery, but it doesn't seem to work. Can you take a look at the code and enlighten me?
<div id="foo"></div>
$('#foo').append('<script> some code </script>');
I would strip your script out off the page into its own nice clean file and then pull it in via jquery
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = url;
$("#someElement").append( script );
Seeing as you are using javascript to insert some javascript, why not just run the javascript snippet:
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
Where you have:
$('#foo').append(...);
Just insert that code from Twitter. It will do the same thing.