Log in

No account? Create an account
LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

just send comment? [Jul. 7th, 2005|11:27 am]
LiveJournal Client Discussions


Hello there. I am Timothy Babych, web developer from Kiev, Ukraine. I am working on greasemonkey script that posts comments from "Friends Entries" page. It uses Ajax and does not require page reloads.


I send comments to talkpost_do.bml with parameters
itemid, journal, usertype, cookieuser, body

and everything works ok, but in the background entire entry with all the comments is loaded

Can I send POST with some mode modifier so that it will not load an entry afterwards?
Something like "Your comment was successfully posted, you can view entry, view all comments..." will do just fine.


(Deleted comment)
[User Picture]From: tymofiy
2005-07-08 08:25 am (UTC)
thanks a lot!
(Reply) (Parent) (Thread)
From: snej
2005-07-08 04:00 pm (UTC)
If you're using Ajax, why not just send the POST yourself via an XMLHTTPRequest? That way the response comes right back to your script, without a page reload, and you can simply check the HTTP status and ignore the body.

On the other hand, I think that, from human interface design principles, loading the updated page with the new comment is a good thing, since it shows the new state of the page. Otherwise the user is left looking at an obsolete page that doesn't incorporate her new comment.

Ideally your script could still bypass the reload by splicing the comment into the page's DOM after the POST succeeds, but I am pretty sure that would require more knowledge of the structure of the HTML than is available, since the journal style can structure the tags pretty much any way it wants.
(Reply) (Thread)
[User Picture]From: tymofiy
2005-07-08 05:23 pm (UTC)
«why not just send the POST yourself via an XMLHTTPRequest»
That is what I do.

«That way the response comes right back to your script»
I just want that responce be small and come quickly — improving user experience and saving his traffic.

And I do indicate that comment was sent in very obvious way.
(Reply) (Parent) (Thread)
[User Picture]From: herbie
2005-07-08 06:53 pm (UTC)
I've got a bug - your ctrl+enter scheme doesn't work on OS X (not with ctrl+enter, apple+enter, or option+enter). Why not at least have a button or something?
(Reply) (Thread)
[User Picture]From: tymofiy
2005-07-08 07:02 pm (UTC)
I do not own a Mac. I did what I could — allowed both Alt+Enter and ctrl+enter. people say it works. How can those modifiers be checked with Javascript?
(Reply) (Parent) (Thread)
[User Picture]From: yanek
2005-10-20 05:44 am (UTC)
Можно каждый раз подставлять имя польз. и пассворд с пометочной "Лог ин".
В таком случае не будут показываться коменты.

(Reply) (Thread)
[User Picture]From: tymofiy
2006-01-01 06:20 pm (UTC)
Так скрипт ведь никак не может знать пароль и логин. Увы, не вариант.
(Reply) (Thread)