javascript - Use jQuery .append() inside a function? -


i've been trying call function appends html tags inside of pre-existing div tags this:

function loadtextbox(jsonurl,divid){ $.getjson(jsonurl, function(json) {     alert('hello');     $('#' + divid).append('<h2></h2>')         .find('h').append(json.heading).attr(json.config.backgroundconfig)         .find('h').attr(json.config.headingconfig).append(json.heading).parent()         .find('p').attr(json.config.bodyconfig).append(json.body);     }) } 

this complex example haven't been able working append() function inside sort of other function. can append fine straight .js otherwise no luck. know fact json calls working use identical call , queries different function. there problem putting append() in function?

edit: note, above alert not work is. if moved 1 line (above $.getjson call works fine. maybe important? also, calling function directly below in same .js file so:

loadtextbox("./json/textbox.json","text"); 

if alert never shows up, when inside function, means you're not receiving response.

if you're using firefox, use firebug plugin see if exception thrown serverside.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -