Should I return the JSON data server and then parse its JavaScript to directly create / render HTML, or do I need my server code to return HTML directly, which can be directly placed by JavaScript.
Thoughts?
Return the server side of the code (for example, as done in Rails AJAX), and then return the view to the client, where it will simply be located.Then write down your code. If this turns out to be too slow, return JSON and think about how to make it client-side.
Your priority for this should be to not do everything that was too combined.
HTML. IMHO JSON - JQOTE 2 . .
(: JQOTE - !)
, , , , " " .., HTML.
- . , . , (, ).
, , . , , javascript .
, , HTML, , , (php). JSON php, JS . javascript.
.
JSON , (X) HTML , , , , .
JSON JavaScript , , - .
; .
, (.. ), , HTML HTML . HTML, . , , , JS .
OTOH, JSON, JS-, . , . JS, JS ( , ..), , . , - . , ( , ..), , , ( ). JSOn , .
, . , ( : - John Resig), bandwith , HTML-, .
-, . , UA, . JSON UA, . , , JSON .
However, if there is significant success when processing data on the client side, then it would be more reasonable to deliver the HTML directly to the client. HOWEVER, I highly recommend that you deliver JSON only to your server-side HTML creation function (and not to UA) so that you can deliver JSON data to multiple endpoints without changing the kernel code in the future.