Hello I'am learning jquery, and I have a problem with following code:

```
<table class="table table-bordered table-striped table-hover datatable">
      <thead>
        <tr>
          <th>ID</th>
          <th>organisation Name</th>
          <th>User name</th>
          <th>Email</th>
          <th>Contact No</th>
          <th>IP</th>
          <th>Date</th>
          <th>Status</th>
        </tr>
      </thead>
      <tbody>
          <tr> <td>3</td>
        <td>Harshit </td>
        <td>AtulSaini</td>
        <td>arpitkumar@gmail.com</td>
        <td>7860458</td>
        <td>::1</td>
        <td>14/03/2015</td><td><button id="status"><span class="label label-success">Active</span></botton></td></tr>

        <tr class="warning"> <td>4</td>
        <td>Meghaa.co.edu</td>
        <td>megha</td>
        <td>meghaa.sing@gmail.com</td>
        <td>7860458</td>
        <td>::1</td>
        <td>14/03/2015</td><td><button id="status"><span class="label label-warning">Deactive</span></botton></td>
        </tr>            

      </tbody>
    </table>

```

I want jquery solution.
When I click button having `id=status`,
the first td of that perticular `<tr>` gets selected 
and sent using Ajax.
In response, the class of that `<tr>` toggles from warning to success, and `<button>` span class also toggles from `label-warning` to `label-success`. 

Here is the code I tried:

```
 <script type="text/javascript">
 $(document).ready(function(){
            $("#status").click(function(){
              var id=$(this tr).find('td:first').html();
              var status=$("span").html();
              var xmlhttp;  
            if (window.XMLHttpRequest)
            {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }
            else
            {// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function()
            {
                if (xmlhttp.readyState==4 && xmlhttp.status==200)
                {
                    var res=xmlhttp.responseText;
                    alert(res);
                    if(res=="n")
                    {
                      $(this tr).removeClass("success");
                      $(this tr).addClass("warning");                      
                    }
                    else{
                     $(this).parents('tr').removeClass("warning");
                      $(this).parents('tr').addClass("success");
                    }
                }
            }
            xmlhttp.open("GET","scripts/update.php?id="+id+"&status="+status,true);
            xmlhttp.send();

            });
        });      

```