Android calls my js method, and the settimeout in it does not execute.

Android calls my js method, and the settimeout in it doesn"t work. Why

        function shareSuccesshide(){
            $("-sharpshareSuccess").hide();
        }

        function shareFailurehide(){
            $("-sharpshareFailure").hide()
        }

        function callback(data) {
            if (browser.versions.ios || browser.versions.iPhone || browser.versions.iPad) {  
                if(data === 1){
    $("-sharpshareSuccess").show();
    setTimeout(function(){
                        $("-sharpshareSuccess").hide();
                    },2000);
    }else if(data === 0){
    $("-sharpshareFailure").show();
    setTimeout(function(){
                        $("-sharpshareFailure").hide()
                    },2000);
    }    
            }else if (browser.versions.android) { 
                if(data === 1){
                //setTimeout
    $("-sharpshareSuccess").show();
    setTimeout("shareSuccesshide();",2000);
    }else if(data === 0){
    $("-sharpshareFailure").show();
    setTimeout("shareFailurehide();",2000);
    }    
            }  
        }
Nov.04,2021

setTimeout should be a function,. Don't you add quotation marks to become a string? how to execute


I don't see anything wrong with the code, so I guess:

  1. the branch code related to android has not been executed. You can console.log to see if it has been executed
  2. . In
  3. task queue, unfinished task, blocks subsequent task execution (callback functions in setTimeout will be put into task queue as task to wait for execution. If other task in the queue queue is executing, then setTimeout will not necessarily execute even after 2s)

setTimeout (shareSuccesshide,2000);

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b40e63-2c558.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b40e63-2c558.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?