Js calls object properties and encounters a very strange thing.

:


ajaxresonseJSONundefined

A piece of meat is right in front of you, but you don"t have the heart to hit people.

Mar.14,2021

classmate, do you know async?


classmate, do you know asynchronous?

return result to console.log (result) ?


when you use the getJSON method


to execute console.log (), your request may not have been executed, that is, the data has not yet been returned


execute ajax first. Of course, undefined


ajax is asynchronous, so it is not strictly from top to bottom


juvenile, asynchronously?


see that the object you print supports then,

var token = $.ajax({
    url: "/get_token", success: function (result) {
        return result
    }
}).then(function(result){
    return result
});

console.log(token.resonseJSON);

?            
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-1bdb8d7-31296.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-1bdb8d7-31296.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?