0

I have the following javascript code on my site that is called when a user saves a bookmark:

function addbookmark(id, col) {
      var action = 'addbookmark';
      var username = '<?php echo $log_username; ?>';
        $("#addbookmark"+id).html('<i class="fa fa-spin fa-spinner"></i>');
         $.post('https://xxxxxxx/bookmarks_system.php', { username: username , id: id, column: col, action:action },
          function(data) {
           $("#addbookmark"+id).hide();
           $("#removebookmark"+id).show()
           $(".fade_notification").text('Bookmark saved');
           $(".fade_notification").delay(100).fadeIn(250);
           $('.fade_notification').delay(3000).fadeOut(400);
          });
  }

This code is working fine on my chrome browser on my laptop, but for some reason it doesn't work when I open the site on my mobile browser (chrome on Android). When I click the button on my mobile, it won't post the data for some reason and keeps showing the spinner icon that is shown when the data is not yet posted.

Anyone who can see why it would not be working on chrome on android?

  • 3
    Start by adding code to handle if the request fails, so see if it fails for some reason. And use the remote debugging functionality of chrome to check the console for any errors. – Torben Pi Jensen Sep 16 '16 at 11:40
  • Any chance to be CORS / OPTIONS issues? [like this discussion](http://stackoverflow.com/questions/15369619/how-to-handle-ajax-jquery-post-request-with-wcf-self-host/39410528#39410528) Probably not. – heringer Sep 16 '16 at 11:43
  • Is it on your localhost? – vaso123 Sep 16 '16 at 12:09
  • i think you need to use in this fashion "username": username , "id": id, "column": col, "action":action. hope it will work –  Sep 16 '16 at 12:34
  • change username:username to "username":username and so on –  Sep 16 '16 at 12:35
  • This worked! Thank you so much for the help, saved my day! @user5405873 – Senne Vandenputte Sep 16 '16 at 13:06

0 Answers0