The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Why javascript/jquery code does not work on android devices?
nilovsergey
post Aug 29 2023, 07:20 AM
Post #1


Newbie
*

Group: Members
Posts: 10
Joined: 15-July 23
Member No.: 28,988



On laravel 8.83 / jquery 3.6.0 app when user clicked on action button and ajax response returned new value is set
(groupedNewsUserActionsCount of response)
into div with id = "#total_actions_" + newsId + "_" + action + "_label" and to assign class 'news-user-reactions-item-voted' into block

I do it with a code :

CODE
    $.ajax({
        type: "POST",
        dataType: "json",
        url: "/news/react",
        data: {"_token": "{{ csrf_token() }}", "newsId": newsId, "action": action},
        success: function (response) {

            $("#total_actions_" + newsId + "_" + action + "_label").html(response.groupedNewsUserActionsCount === 0 ? '' : response.groupedNewsUserActionsCount)

            // Make _cancel action button visible and hide add action button
            $("#a_" + newsId + "_" + action + "_add_action").css('display', 'none')

            $("#a_" + newsId + "_" + action + "_cancel_action").css('display', 'block')

            // User voted this action : show icon image in light blue color
            $("#div_" + newsId + "_" + action + "_add_action_block").attr('class', 'news-user-reactions-item-voted')
        },
        error: function (error) {
            console.log(error)
        }
    });

That works ok on common browsers, but does not work properly(new value is not set and class is not changed) on android devices.
Do I use some invalid methods which are not valid for android devices ?
Which methods have I to use ?


I make test with Samsung Galaxy A 50 and when my page is opened in chrome browser I found option/checkbox
"Version for comp" - if to turn it on the the page is reopeened at first - and after that all functionality with new
value applied and class changed new class changed WORKS properly! What option is it and how I use it in my issue ?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 04:25 PM