In this article I will explain with an example, how to get HttpResponse Message and HttpStatusCode using jQuery AJAX function.
For illustration purposes, this article makes call to an ASP.Net Web Service which returns HttpResponse Message and HttpStatusCode.
Web Service
Following is the Web Service (ASMX) for returning the HttpResponse.
This Web Service (ASMX) returns an OK response along with HttpStatusCode to the Client.
using System;
using System.Web;
using System.Web.Services;
using System.Net;
/// Summary description for Service.
[WebService(Namespace = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService {
    public Service()
        //Uncomment the following line if using designed components
    public void CheckStatus()
        //Send OK Response to Client.
        HttpContext.Current.Response.StatusCode = (int)HttpStatusCode.OK;
Imports System.Web
Imports System.Web.Services
Imports System.Net
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="")> _
Public ClassService
    Inherits System.Web.Services.WebService
    Public Sub CheckStatus()
        'Send OK Response to Client.
        HttpContext.Current.Response.StatusCode = CInt(HttpStatusCode.OK)
    End Sub
End Class
Adding Web Reference of Web Service
Next thing you need to do is add the Web Reference of the Web Service so that it can be used on the ASP.Net Web page.
Please refer the following article for instructions in adding Web Reference of Web Service: How to add reference of Web Service (ASMX) in ASP.Net using Visual Studio.
HTML Markup
The HTML Markup consists of an HTML Button.
The Button has been assigned a jQuery Click event handler. When the Button is clicked, the Web Service (ASMX) is called using jQuery AJAX.
The HttpResponse along with HttpStatusCode are received in the Success event handler which are later displayed using JavaScript Alert Message Box.
<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <input type="button" id="btnCheck" value="Check Status"/>
        <script type="text/javascript" src=""></script>
        <script type="text/javascript">
            $("body").on("click", "#btnCheck", function () {
                    url: 'Service.asmx/CheckStatus',
                    type: 'POST',
                    data: {},
                    success: function (data, textStatus, http) {
                        alert("Data: " + data + "\nTextStatus: " + textStatus + "\nHttpStatus: " + http.status);
                    error: function (r) {
                    failure: function (r) {
jQuery AJAX: Get HttpResponse Message and HttpStatusCode
Browser Compatibility

The above code has been tested in the following browsers.

Internet Explorer  FireFox  Chrome  Safari  Opera 

* All browser logos displayed above are property of their respective owners.