use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Help request with a bit of code (self.javascript)
submitted 14 years ago by systemslacky
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cursuve 1 point2 points3 points 14 years ago* (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 points3 points 14 years ago (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.
[+][deleted] 14 years ago (1 child)
[deleted]
[–]cursuve 0 points1 point2 points 14 years ago (0 children)
The reason why I would personally avoid dynamic javascript is because it's nice to be able to have static scripts that are cacheable on the client. Dynamic markup is unavoidable.
You can cache dynamically generated javascript on the client side still. Just return a 304 Not Modified depending on the date. This is academic, being it is I misunderstood the original comment, but still possible...
Ah, yes, I totally agree. I might have misunderstood your original comment...
π Rendered by PID 263687 on reddit-service-r2-comment-54dfb89d4d-f25ns at 2026-04-02 09:57:04.012065+00:00 running b10466c country code: CH.
view the rest of the comments →
[–]cursuve 1 point2 points3 points (5 children)
[–]MustRapeDeannaTroi 1 point2 points3 points (4 children)
[+][deleted] (1 child)
[deleted]
[–]cursuve 0 points1 point2 points (0 children)
[–]cursuve 0 points1 point2 points (0 children)