开发者

AJAX and prediction of actions

I'd like to ask your opinion on this. This is a theoretical question.

I'm in a situation where I have an interface shown to a user that uses AJAX to talk to the server. The server-side language does not matter here. I have a form with fields and each of them are deletable. If the user selects a few "delete" -checkboxes and presses Update, then I have these two options to do:

Option 1: When deleting fields, use JavaScript to remove the HTML immediately and run AJAX on background to delete those fields. This achieves a look of a fast interface -> better user experience. However, if the AJAX call fails on the server side (the fields couldn't be deleted), then the previously deleted HTML fields would give a false assumption for the user (of them being deleted).

Option 2: When deleting fields, run AJAX, depending on its success, either remove the HTML or do not. This gives accura开发者_StackOverflow中文版te feedback for the user, but the form would freeze until the AJAX call finishes = slow(er).

What are your thoughts? Which approach seems better for me to take or should I make it an option?


Option 3: Mark the controls as being deleted (e.g. overlay a translucent gray box with a delete icon on it). Send the request. When it returns, either remove the controls, or change the box to show an error icon for a few seconds (then remove the box).

Allow the rest of the interface to be interacted with while this goes on.


Nice question.

A third option would be to :

  1. disable immediately the controls
  2. delete them when the Ajax returns

This gives the user feedback that something was effectively requested (responsiveness), while showing also the moment where it is effectively completed.


Also, the user somehow feels the "distant call", which does not induce him in error, because it is was really happens. Anyway, there is nothing meaningful we can do to hide this feeling, because the delay will always be there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜