HTTP Response Codes

Oct 29, 2013 at 9:50 PM
Need some sample on how can I get the HTTP response code if my OData Request fails. When I try to prompt the error message in error call back all I get is a generic message that "HTTP Request fail...

function login() {
var userId = $("#txtUserId").val();
var password = $("#txtPassword").val();
if (userId == "") {
    alert("User Id is empty");
    return false;
if (password == "") {
    alert("Password is empty");
    return false;
else {
    // Validate by making a server call
    alert('Inside server validate call');
    var request = {
        headers: getHeaders(), // object that contains HTTP headers as name value pairs 
        requestUri: tlyticsServiceUrl, // OData endpoint URI 
        method: "GET",
        datatype: "json"
            function (data, result) {
                                //Perform the Success steps
            function (err) {
               // Need the status codes here to manipulate results              });
    return true;
Oct 30, 2013 at 11:08 PM
Hi, you can try "err.response.statusCode".