How to delete data in mysql DB from table td using ajax?
<p>My goal here is to delete the correspondent &lt;td&gt; data in mysql db table using AJAX.
So I've generated a table with several rows and want to a non specific row...</p>

<p>PHP Code:</p>

<pre><code>&lt;?php
if(isset($_SESSION['login_status'])){

require 'classes/datahandle.class.php';
$data = new Datahandle();

    $query = "
        SELECT
            e.place,
            e.id_station,
            g.description,
            ac.max, ac.min,
            ac.mensagem
        FROM unit g, tableA ac, station e
        WHERE client = '" . $_SESSION['user_id'] . "'
            AND ac.unit=g.field
            AND ac.id_station=e.id_station
    ";

    $result = $data-&gt;selectDataQuery($query);
    $numRows = $data-&gt;getAffectedRows();

    if($numRows &gt; 0){
            ?&gt;
            &lt;table id="consAlerts" border="0" align="center"&gt;
                    &lt;tr&gt;
                    &lt;td style="text-align: center; color: white; font-weight: bold;"&gt;Value 1&lt;/td&gt;
                    &lt;td style="text-align: center; color: white; font-weight: bold;"&gt;Value 2&lt;/td&gt;
                &lt;td style="text-align: center; color: white; font-weight: bold;"&gt;Value 3&lt;/td&gt;
                &lt;td style="text-align: center; color: white; font-weight: bold;"&gt;Value 4&lt;/td&gt;
                &lt;td style="text-align: center; color: white; font-weight: bold;"&gt;Value 5&lt;/td&gt;
                &lt;td colspan="2"&gt;&lt;/td&gt;
                    &lt;/tr&gt;
        &lt;?php
            while ($alert = mysql_fetch_array($result)) {
            ?&gt;
                    &lt;tr&gt;
                    &lt;td&gt;
                    &lt;select class="stationCons" disabled="disabled"&gt;
                    &lt;?php
                        $query = "SELECT id_station,place FROM station";
                        $queryResult = $data-&gt;selectDataQuery($query);

                        while($option = mysql_fetch_array($queryResult)){
                                if($alert['id_station'] == $option['id_station']){
                                ?&gt;
                                        &lt;option value="&lt;?php echo $option['id_station']?&gt;" selected &gt;&lt;?php echo $option['place']?&gt;&lt;/option&gt;
                                &lt;?php
                                }if($alert['id_station'] != $option['id_station']){
                                ?&gt;
                                        &lt;option value="&lt;?php echo $option['id_station']?&gt;"&gt;&lt;?php echo $option['place']?&gt;&lt;/option&gt;
                                &lt;?php
                                }
                        }
                    ?&gt;
                    &lt;/select&gt;
               &lt;/td&gt;
                                    &lt;td&gt;
                    &lt;select class="unitCons" disabled="disabled"&gt;
                    &lt;?php
                        $query = "SELECT field, description FROM unit";
                        $queryResult = $data-&gt;selectDataQuery($query);

                        while($option = mysql_fetch_array($queryResult)){
                                if($alert['description'] == $option['description']){
                                ?&gt;
                                        &lt;option value="&lt;?php echo $option['field']?&gt;" selected="selected"&gt;&lt;?php echo $option['description']?&gt;&lt;/option&gt;
                                &lt;?php
                                }if($alert['description'] != $option['description']){
                                ?&gt;
                                        &lt;option value="&lt;?php echo $option['field']?&gt;"&gt;&lt;?php echo $option['description']?&gt;&lt;/option&gt;
                                &lt;?php
                                }
                        }
                    ?&gt;
                    &lt;/select&gt;
                            &lt;/td&gt;
                            &lt;td&gt;
                    &lt;input type="text" class="consMax" value="&lt;?php echo $alert['max'] ?&gt;"/&gt;
                &lt;/td&gt;
                            &lt;td&gt;
                    &lt;input type="text" class="consMin" value="&lt;?php echo $alert['min'] ?&gt;"/&gt;
                &lt;/td&gt;
                            &lt;td&gt;
                    &lt;input type="text" class="msg" value="&lt;?php echo $alert['mensagem'] ?&gt;"/&gt;
                            &lt;/td&gt;
                            &lt;td&gt;
                    &lt;input type="submit" class="delete" value="Delete"/&gt;
                &lt;/td&gt;
                            &lt;td&gt;
                    &lt;input type="submit"  class="edit" value="Edit"/&gt;
                &lt;/td&gt;
                    &lt;/tr&gt;
            &lt;?php
            }
            ?&gt;
    &lt;/table&gt;
    &lt;?php
    }if ($numRows == 0) {?&gt;
            &lt;div style="color:#FFF; font-weight:bold; padding:10px; text-align:center;"&gt;Sometext&lt;/div&gt;
&lt;?php
    }
} else
    echo "&lt;meta http-equiv='refresh' content='1; URL=../index.php'&gt;";
?&gt;
</code></pre>

<p>JQUERY:</p>

<pre><code>&lt;script type="text/javascript"&gt;
&lt;!--
$(document).ready(function() {
    $(".delete").click(function(){
            //AJAX CALL
                    $.post("phpValidationScript.php", { station:$(".stationCons").val(), grandeza:$(".unitCons").val(), consMax:$(".consMax").val(), consMin:$(".consMin").val(), msg:$(".msg").val() }, function(data){
                            alert(data);
                    });
    });
    return false;
});
//--&gt;
&lt;/script&gt;
</code></pre>

<p>My code deletes ONLY the first row...
How can I refer to the proper td values?
And pass them to the ajax?</p>

<p>EDIT:
I'm getting this error:
TypeError: object is not a function [http://127.0.0.1/somesite/index.php?page=consAlerts:[35]</p>

<p>The error refers to the bellow code:</p>

<pre><code>$.post("validaConsApagar.php", { estacao:$(this)(".estacaoCons").val(), grandeza:$(this)(".grandezaCons").val()}, function(data){...
</code></pre>

<p>So this is not a function that means that the syntax is wrong? </p>
