Put Javascript Into Jquery .html Function
I'm trying to replace the contents of a div with other contents, both contents are JavaScript codes, however, when I press the button that calls the function, the whole page refres
Solution 1:
There's really no reason to dynamically inject an inline script tag into a DOM element. Just execute the body of the script tag as regular JavaScript.
function refresh() {
alert("button pressed");
new TWTR.Widget({version: 2, type: "search", search: "#abbaseya", interval: 15000,
subject: "widget", width: 300, height: 360,theme: { shell: { background:
"#8ec1da", color: "#ffffff" },tweets:
{background:"#ffffff",color:"#444444",links:"#1985b5"}},features:
{scrollbar:true,loop:true,live:true,behavior:"default"}}).render().start();
return false; // prevent refresh
}
Post a Comment for "Put Javascript Into Jquery .html Function"