I was writing a function that shows dialogwindow on the button click:here the piece of code related to status and statusCode.
if(response.status>300){
jQuery("#myModal").modal("show");
}else{
vm.someFunction();
}
// when I run the code above I got result working, however when I wrote //the following:
if(response.statusCode>300){
jQuery("#myModal").modal("show");
}else{
vm.someFunction();
}
// it does not work although my statusCode was 500;
So, my question is: what is the difference between status and statusCode and when I should use some of them.?
Client-side (in the browser), and using XMLHttpRequest or fetch, the correct property to use is called response.status
Server-side, in Node.js, using http.ClientRequest (when dealing with the response of an HTTP request that you made using Node.js), the correct property to use is called response.statusCode
Also server-side, in Node.js, using http.ServerResponse (to set a status code for a particular response), the correct property to use is also called response.statusCode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With