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

javascript - How to diff two immutable objects -

javascript - React.js: onClick function from child to parent -

c# - How can I have the VS Debugger break in the correct location for exceptions thrown in Async methods in a Console App? -