Javascript or PHP to display data? -


i'm using php display data on page using echo, thought faster javascript. i'm wondering though if should passing data page via json , have javascript show data instead. think give me more flexibility.

current code:

 <span class="label">variable: </span><?php echo $model->variable ?> 

with advancement in js frameworks, more practical render data via javascript these days?

i advise separating javascript , html php , go structuring application in restful design.

this gives high level of flexibility treating server side code api javascript on front end can make calls (using ajax) in order retrieve data. make program easier expand can work on server side , client side separately , not accidentally adversely affect other parts of application.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -