|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.
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.
«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.