Here is my code.. This is giving me a hard time though I know there is a simple answer
var myVAr = '<%=data.name%>';
$(myVAr).insertAfter("#thisDiv");
You must call insertAfter on a jquery object. So you could do:
var myVAr = $('<input>',{name :'<%=data.name%>', type: "text"} );
myVAr.insertAfter("#thisDiv");
fiddle here http://jsfiddle.net/FhUF5/
Make sure the data.name does not have a ' inside it as it will break the javascript string.
And then make sure that the jquery code is executed after the page has loaded
var myVAr = '<%=data.name%>';
$(function(){
$(myVAr).insertAfter("#thisDiv");
});
If the data.name does not represent valid html code, and you just want the data.name to be inserted as text after the #thisDiv then make a tag with jquery which holds the data.name
var myVAr = '<%=data.name%>';
$(function(){
$('<span>',{text:myVAr}).insertAfter("#thisDiv");
});
data.name? Your code you posted seems to be correct given thatdata.nameexists and has a value that is understandable by jQuery.