Quantcast
Viewing all articles
Browse latest Browse all 3491

First event after resume is ignored

Hi,
This might be a mistake in my code but i'm not sure how to solve it. I have a form which sends ajax request on submit and if for example email is already used, it returns an error. Now, i tried to use pause/resume to prevent sending multiple requests, however when i pause, and then resume, submitting again will not work the first time, only the second time.

  1. 'form.register submit': function(element, event) {
  2.       event.pause();
  3.       var user = new Model.User(can.deparam(form.serialize()));
  4.       user.save(
  5.             function(response) {
  6.                   //irrelevant
  7.             },
  8.             function(error) {
  9.                   //show error, etc
  10.                   event.resume();
  11.             }
  12.       );
  13. }

Viewing all articles
Browse latest Browse all 3491

Trending Articles