Simple "label".text change not working?

I am new at this...so please bare with me.

Simple json call, looking for userdata = true in response
the set Name_Field.Text is not working.



Server side is pretty simple.

If I click the logoff button the IF statement for it works. But doing a json call and trying to get user data to the label on the screen doesn't work. I am wondering what it could be. I've hit beat my head on this for about 2 hours now.

<?php 
session_start();
include "./helpers/functions.php";


// Takes raw data from the request
$json = file_get_contents('php://input');

// Converts it into a PHP object
$data = json_decode($json);
$jsonArr = array();

openlog("myScriptLog", LOG_PID | LOG_PERROR, LOG_LOCAL0);

if($data->logoff == true){
    $sql = "SELECT * FROM users WHERE app_key = '".$data->app_key."';";
    $info = dbread($sql);
    if(isset($info[0])){
        syslog(LOG_WARNING, "log off request - userid = ".$data->app_key);
        $jsonArr['logoff'] = true;
    }
    else{
        syslog(LOG_WARNING, "no user found possible false request- ".$data->app_key);
        $jsonArr['logoff'] = false;
    }
    //send json response
    $jsonSend = json_encode($jsonArr);
    echo $jsonSend;
    
}
if($data->userinfo == true){
    $sql = "SELECT * FROM users WHERE app_key = '".$data->app_key."';";
    $info = dbread($sql);
    if(isset($info[0])){
        syslog(LOG_WARNING, "getting user data- ".$data->app_key);
        $jsonArr['userdata'] = true;
        $jsonArr['first'] = $info[0]['first'];
        $jsonArr['last'] = $info[0]['last'];
        $jsonArr['email'] = $info[0]['email'];
        $jsonArr['phone'] = $info[0]['phone'];
    }
    else{
        syslog(LOG_WARNING, "no user found possible false request- ".$data->app_key);
        $jsonArr['appdata'] = false;
    }
    //send json response
    $jsonSend = json_encode($jsonArr);
    echo $jsonSend;
}
closelog();
?>

Did you verify if the global response is not empty?
Where you save and how you save the key userdata?

Show your raw responseContent before attempting dictionary extract. What is coming back from the server?

Thanks guys for the hint to check the actual raw data being sent. I am slight embarrassed by this :rofl:

did a wireshark trace and saw this

then I realized I was not watching the apache error log, I was watch syslog.

Modified my Server code to detect if the json key is actually set.

if(isset($data->logoff)){
    if($data->logoff == true){
        $sql = "SELECT * FROM users WHERE app_key = '".$data->app_key."';";
        $info = dbread($sql);
        if(isset($info[0])){
            syslog(LOG_WARNING, "log off request - userid = ".$data->app_key);
            $jsonArr['logoff'] = true;
        }
        else{
            syslog(LOG_WARNING, "no user found possible false request- ".$data->app_key);
            $jsonArr['logoff'] = false;
        }
    //send json response
    $jsonSend = json_encode($jsonArr);
    echo $jsonSend;
    }
    
    
}
if(isset($data->userinfo)){
    if($data->userinfo == true){
        $sql = "SELECT * FROM users WHERE app_key = '".$data->app_key."';";
        $info = dbread($sql);
        if(isset($info[0])){
            syslog(LOG_WARNING, "getting user data- ".$data->app_key);
            $jsonArr['userdata'] = true;
            $jsonArr['first'] = $info[0]['first'];
            $jsonArr['last'] = $info[0]['last'];
            $jsonArr['email'] = $info[0]['email'];
            $jsonArr['phone'] = $info[0]['phone'];
        }
        else{
            syslog(LOG_WARNING, "no user found possible false request- ".$data->app_key);
            $jsonArr['appdata'] = false;
        }
        //send json response
        $jsonSend = json_encode($jsonArr);
        echo $jsonSend;
    }
    
}

I am now seeing the text on screen

image