Passing variables to .load(html) in jQuery?

Put HTML where it belongs, in the HTML file. Then use a templating plugin on jQuery to expand it.

Up vote 1 down vote favorite 1 share g+ share fb share tw.

Say I have jquery code like this: html += '' + item. Index + ''; // many more similar html += statements // load items $('div'). Append(html); This html is getting too unmanageable, so I'd like to move it to an external file.

What's the best way to pass variables to the HTML as I load it? Do I just have to load it and then put jquery commands in the first JS file? That's what it seems like, but I'd rather use a more template-like method.

Jquery jquery-event-binding link|improve this question edited Oct 17 '08 at 21:43Owen18.4k15067 asked Oct 17 '08 at 21:20jamtoday1,09811330 77% accept rate.

Put HTML where it belongs, in the HTML file. Then use a templating plugin on jQuery to expand it. Some template plugins: jsRepeater jTemplates noTemplate.

I have been looking for a client side replacement for the ASPx Repeater. Looks like you nailed it. Thanks so much.

Helpful++ – Dr. Zim Apr 21 '09 at 0:55.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send