javascript - Dynamically adding html from external view -


i have function in javascript appending html div like:

$("#test").html("<tr><td>" + data[0].foo + "</td></tr>"); 

i don't want html in code, want place external file , load variable. data variable? how pass external file? how use it?

you can store code in file (let's script.js because i'm feeling creative), , using jquery function $.getscript( "script.js") load script page. if have name in variable, that's not problem, can use

var scriptsrc="script.js"; $.getscript(scriptsrc); 

does answer question?


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -