开发者

what is the best way to deal with ajax and generating html that is beyond prototyping

For my project I am starting to get alot of embeded htm开发者_JAVA技巧l in my javascript as a result of ajax calls. I want to move them out of there. What is the best practice for this? I was thinking have the elements as a div in the page with display:none then deal with when the javascript needs it.

But If I use this method I need to replace certain string with the data return from my ajax call, any advise on that?

Thanks


You could use a templating framework such as jquery templates. Here's a blog post about it.

The are also other engines you might take a look at:

  • mustache
  • EJS
  • JavaScript Micro-Templating
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜