Getting Null response instead of json in jquery post from aspx.cs page
<p>I am working on simple application where i am hitting the <strong>Request.aspx</strong> page from <strong>default2.aspx</strong> using jquery ajax post method as you can see below:</p>

<p><strong>js page:</strong></p>

<pre><code>$(document).ready(function () {
$("#login").click(function () {
    var email = $("#email").val();
    var password = $("#password").val();
    $.ajax({
        type: "POST",
        url: "Request.aspx?Login=True",
        data: "{'username': '" + email + "','password': '" + password + "'}",
        cache: false,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {
            console.log(response);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            var url = "http://google.com";
            //$(location).attr('href', url);
        }
    });
});
</code></pre>

<p>});</p>

<p><strong>Default.aspx:</strong></p>

<pre><code>&lt;head runat="server"&gt;
&lt;title&gt;&lt;/title&gt;
&lt;script src="Scripts/jquery-1.4.1.js" type="text/javascript"&gt;&lt;/script&gt;

&lt;script src="Scripts/LoginCode.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
    &lt;div class="container"&gt;
        &lt;div class="main" id="loginform"&gt;
            &lt;label&gt;
                Email :&lt;/label&gt;
            &lt;input type="text" name="demail" id="email" /&gt;
            &lt;label&gt;
                Password :&lt;/label&gt;
            &lt;input type="password" name="password" id="password" /&gt;
            &lt;input type="button" name="login" id="login" value="Login" /&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
</code></pre>

<p><strong>Request.cs Page:</strong></p>

<pre><code> protected void Page_Load(object sender, EventArgs e)
{

    if (Request.QueryString["Login"] != null)
    {

            test();

    };

}



private string test()
{
    var response = new ResponseResult();
    var javaScriptSerializer = new JavaScriptSerializer();
    response.Status = -1;
    response.ErrorMessage = "";
    response.Action = "UserProjects";
    response.Data = "The Username or password you entered is not valid";
   return javaScriptSerializer.Serialize(response);
}

public class ResponseResult
{
    public string Action { get; set; }
    public int Status { get; set; }
    public string ErrorMessage { get; set; }
    public object Data { get; set; }
}
</code></pre>

<p><strong>Problem:</strong>
In response NUll is coming but i am expected json. Please let me know where i am going wrong.</p>

<p>If you need more info i will try my best to provide.</p>

<p>Thanks in advance.</p>