Cons - it's still a refresh, looks like a bit of a mess
2. Use javascript to capture the text and input it in on the click event
Pros - nice and easy to do, looks seamless
Cons - you're not catching error, and you're already posting back so it might look messy anyway, clientside data might end up in mismatch with serverside data (bad!)
3. Use AJAX, put the form you're posting back into an async component
Pros - Does everything you want
Cons - It's much more work than the other two
The answer here is really to use the Microsoft AJAX framework
if(data == 0)
{
jQuery("#commentPosted").addClass("error").html( <%= Umlaut.Umb.Blog.BlogLibrary.Dictionary(
"#CommentFailend","Your comment could not be posted,
we're very sorry for the inconvenience") %> ");
jQuery("#commentform").show();
jQuery("#commentform #submit").attr("enabled", true);
}
else
{
//here
}
Blog4Umbraco show posted comment immediately
Hi all
Is there a way that when a visitor posts a comment, the comment is directly added to the page without needing to refresh the page?
Thanks anyway
Thijs
1. Force a refresh using javascript
Pros - takes 30 seconds to do
Cons - it's still a refresh, looks like a bit of a mess
2. Use javascript to capture the text and input it in on the click event
Pros - nice and easy to do, looks seamless
Cons - you're not catching error, and you're already posting back so it might look messy anyway, clientside data might end up in mismatch with serverside data (bad!)
3. Use AJAX, put the form you're posting back into an async component
Pros - Does everything you want
Cons - It's much more work than the other two
The answer here is really to use the Microsoft AJAX framework
Thank you for the response. I'm going for the javascript way. Here's my code for the people who are interested.
I inputted this code in usercontrols/Blog4Umbraco/AjaxCommentForm.ascx in the submithandler, under the ajax post.
Thijs
What happens if for some reason the system rejects the comment? The user will think it has worked...
If you put it here?
is working on a reply...