Some ajax and json variable game

Doesn’t work

myAjaxdou.open("POST", "https://www.example.com/test.php");
        myAjaxdou.onreadystatechange = function sendcheck() {
        if (myAjaxdou.readyState == 4) {
                var liste = myAjaxdou.responseText; 

( ////// liste = is retrived and returned {"message":"test lala","idlast":"222"} or  {"message":"test lala"} 
                
    obj = JSON.parse(liste);
     message = obj.message;
     idlast = obj.idlast;
        document.getElementById("almake").innerHTML = idlast;

((// only works with  {"message":"test lala"}  but not with   {"message":"test lala","idlast":"222"} i need more variables not just one

     
                       }
        
    
};

        myAjaxdou.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");         
        myAjaxdou.send("do="+daa+"&aid="+id+"&alname="+alname);
}

can someone help me out, don’t know the JS as well as PHP, what’s wrong with this, I need the second one 2

Thank you for your time!

What does the console say when it doesn’t work?

I just tried again just now, It seems to work, don’t know why my 50 tries didn’t work before, anyways I made a workaround and I don’t need this anymore, so…I am not investigating this any further, at this time.

Thank you Paul!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.