Reputation: 2063
During times when a website is experiencing a lot of traffic, sometimes the functionality of a lot of the form buttons do not work on the web page. For example here is the code for the web pages "add to cart" button...
<fieldset id="add-remove-buttons">
<input class="button" name="commit" type="submit" value="add to cart">
<a href="/shop" class="button continue">keep shopping</a>
</fieldset>
<script id="cart-controls-add" type="text/x-nano-tmpl">
<form accept-charset="UTF-8" action="/shop/170325/add" class="add" data-remote="true" id="cart-addf" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="✓" />
<input name="authenticity_token" type="hidden" value="YzR1rCDbfkdbY9M7Fvlx61/adGM9rO51uo6kFFBtdnk=" /></div>
<fieldset>
<input id="size" name="size" type="hidden" value="40401" />
<a href="/shop/accessories/ysw1o8v0k" class="next">next accessory ></a>
</fieldset>
<fieldset id="add-remove-buttons">
<input class="button" name="commit" type="submit" value="add to cart" />
<a href="/shop" class="button continue">keep shopping</a>
</fieldset>
</form>
</script>
Is this just something that is an issue on the server side that cannot be mitigated on client-side? I was thinking about using a while loop to keep submitting input function until it succeeds but sometimes it never succeeds. Or might it be better to do a site refresh, try again, if not, then refresh and try again, repeat? Any input would be greatly appreciated!
Upvotes: 0
Views: 252
Reputation: 1165
It's possible the request is timing out. Rather than resubmitting, (which just adds to the load,) if you change this to a JavaScript AJAX call, you can set a timeout on the client side. Depending on what your server is, you can look at the timeout settings on the server-side. I'd put up a visual indication like a spinner until you get a success or failure back from an AJAX call.
Upvotes: 1