Fixing ajax request on client side