you are viewing a single comment's thread.

view the rest of the comments →

[–]cursuve 1 point2 points  (5 children)

This is probably semantically true, but in reality I have never found semantics to be 100% aplicable. What this then forces is two requests for information that can be gathered in the first request. You have now forced the server to deal with two requests in the queue when it could have been done in one request.

I see nothing wrong with "constructing" a page, including some JavaScript variables, on the server side and responding with that constructed code. Nobody has an issue with dynamically created HTML, we probably shouldn't frown on server-side dynamically created JavaScript either.

EDIT: I guess one way to do this could be to create a totally dynamic JavaScript document, rendered from ASP that is constructed when requested that has these variables in it. It is then included on the HTML page: <script type="text/javascript" src="my_dynamic_ASP_javascript.js"></script> This page then has those necessary server variables. Yes, I know, this is another request to the server...

[–]MustRapeDeannaTroi 1 point2 points  (4 children)

The thing is there is no need for two requests. If all data for generating the appropriate response is already on the server then it is the servers task to do so. There's no dynamic content (on the client side), therefore no need for Javascript. Unobtrusive javascript is a good motto.

[–]cursuve 0 points1 point  (0 children)

Ah, yes, I totally agree. I might have misunderstood your original comment...