• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clean up script

 
Todd Smith
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to clean up my code. I am getting a JSON Object returned from my spring controller and I am display it using the Jquery .append method. It looks very messy. Should I be using jQuery Template Markup Language (JTML) to clean it up. Please advise



[Edit: modified subject as this has nothing to do with JSP]
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So a couple of things:

1. If you're going to use jQuery, use jQuery


2. I'm still doing some testing to determine the merits of jQuery Template API over letting the server do it. In your case, I might just use jQuery's load() function. Let the server generate your HTML and just plop that rendered HTML into a container using load().
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Way too many appends.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like Gregg, I'm a big fan of letting the server do the work. I prefer to deliver pre-formated HTML fragments (templated using JSP or other server-side templating) over client-side DOM manipulation or templating. I use the client-side mechanisms only when it makes more sense than doing it on the server.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic