The moose likes HTML, CSS and JavaScript and the fly likes hardcoding in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "hardcoding in javascript" Watch "hardcoding in javascript" New topic

hardcoding in javascript

ramesh maredu
Ranch Hand

Joined: Mar 15, 2008
Posts: 210


In our application we use json to carry data from server, ajax calls are made using jquery, the json response is used to construct html dynamically.

The rendering logic varies according to attributes in json response, for example

I would like to know is there any elegant way there, not to hard code in java script, I mean can I read values 1 and 2 dynamically and use them in comparison.

SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
A switch statement

A look up way


I agree. Here's the link:
subject: hardcoding in javascript
It's not a secret anymore!