Slow AJAX response causing errors

My site is for a non-profit and the online store includes physical products for sale and gives guests the ability to make a donation.

I received feedback from a customer say that they entered a donation amount and hit submit but just keep looping back to the same page.

It looks like wpcomethod is posting to admin-ajax.php every time a customer types a character in the "amount" field of the donation. Each time they type another character it sends another post request.

If the user hits the "submit" button before we get the response back from the server, it submits nothing (and thus returns the user to the product page).

Two things that will help/solve this problem:

1. Is there a way to force the "submit" "donate" or "buy now" buttons to wait -- only activate after we get the response from the post to admin-ajax?

2. Can you pause for a few ms and wait for a user to finish typing before sending the post to the server?

2. Is there a way to get a faster response?  The response time is about 1.72S - 2.5S (seconds, not ms!) . It seems awfully long. If the response came in faster, then I wouldn't have this problem. Everything else on my site seems fast enough.

Here's a direct link to the product in question on my site:  DONATE TO SFGMC

Here's a screen shot showing the post that gets aborted every time a character is typed.
image

Comments

  • 1 Comment sorted by
  • Vote Up0Vote Down
    Hi Paul,

    Thank you for your post.

    The aborted Ajax is fine... let me explain:

    As soon as anything on the product page is changed like variations, custom fields, quantity, etc... the Ajax request starts. If another change is made (like another character is typed) the data has changed so the current Ajax request is stopped/aborted and a new one is started with the new, changed data.

    This is as it should work.

    I hope that's all right with you? I tested the donation product a few times and couldn't replicate the issue the customer had, unfortunately. It may have been a once-off issue with a temporary glitch somewhere between the site and the user being the cause?

    I look forward to your reply.

    Kind regards,

    Phil
Sign In or Register to comment.