Change css in jquery ajax with asp.net
<p>I wolud like to get results: 2222 .but i can not get the results now.Output '3333' always.
can anyone help me out ?thank you very much!</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 language="javascript" type="text/javascript"&gt;
    $(function () {
        $("#Button1").click(function () {
            checkCard('333');
            var arrlist = $("span[class='error']");
            if (arrlist.length &gt; 0) {
                alert('2222')
            }
            else {
                alert('3333');
            }
        });
    })
    function checkCard(card_no) {
        $.ajax({
            type: "GET",
            url: "CheckCard.ashx?card_no=" + card_no,
            success: function (data) {
                if (data == "true") {
                    $("#sw").addClass("error");
                }
                else {
                    $("#sw").removeClass("error");
                }
            }
        });
    }
 &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
 &lt;form id="form1" runat="server"&gt;
 &lt;div&gt;
    &lt;span id="sw"&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/form&gt;
    &lt;input id="Button1" type="button" value="button" /&gt;
&lt;/body&gt;

CheckCard.ashx:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;

namespace SwipeCard
{
/// &lt;summary&gt;
/// Summary description for CheckCard
/// &lt;/summary&gt;
public class CheckCard : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/html";

        context.Response.Write("true");

        context.Response.End();

    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}
}
</code></pre>

<p>I wolud like to get results: 2222 .but i can not get the results now.Output '3333' always.
can anyone help me out ?thank you very much!</p>
