Live data from Hacker News

Finally, voting without refresh

ycombinator.com

1–10 of 45 posts

Re: Finally, voting without refresh

#7
I'm curious why you're averse to learning and using javascript, Paul. It's really close to Lisp (no compile-time macros, but functions are first class objects, has lexical closures, so on). It's really a powerful language, much more so than C.

(Not criticizing, just curious)

Re: Finally, voting without refresh

#9

Does it make the request, then update the number? Or does it update the number and make the request at its leisure?

Well, look at the code :) I did, it was educational. Node.href contains the values that are linked on the up/down arrows.

// ping server

var ping = new Image();

ping.src = node.href;

return false; // cancel browser nav

}

The clever part is in using the image object as an ajax-like connection, response isn't check, and I'm not sure if it's async. Question: is this a common javascript idiom? Is it browser portable?

Mynameishere: The answer to your question is it updates the number and makes an immediate request to the server.

Re: Finally, voting without refresh

#10
post #9

Does it make the request, then update the number? Or does it update the number and make the request at its leisure?

Well, look at the code :) I did, it was educational. Node.href contains the values that are linked on the up/down arrows. // ping server var ping = new Image(); ping.src = node.href; return false; // cancel browser nav } The clever part is in using the image object as an ajax-like connection, response isn't check, and I'm not sure if it's async. Question: is this a common javascript idiom? Is it browser portable? Myn…

Er.. So that means it's a GET request, and GET requests which modify state on a website are bad. Things like Google Web Accelerator silently visit all the links on the page and cache the result in case you decide to visit that link. So there might be some problems for people using those (For example, their accelerator might accidentally upvote all the comments in every comment page they visit)
Post reply on HN