February 2018
Intermediate to advanced
298 pages
8h 22m
English
For asynchronous JavaScript APIs involving events, you need to register the success and error event handlers that will be executed depending on whether the operation was a success or failure respectively.
For example, while making an AJAX request, we register the event handlers that will be executed depending on whether the AJAX request was made successfully or not. Consider this code snippet, which makes an AJAX request and logs the retrieved information:
function displayName(json) { try { //we usally display it using DOM console.log(json.Name); } catch(e) { console.log("Exception: " + e.message); }}function displayProfession(json) { try { console.log(json.Profession); } catch(e) { console.log("Exception: ...Read now
Unlock full access