My goal here is to delete the correspondent data in mysql db table using AJAX. So I've generated a table with several rows and want to a non specific row...
PHP Code:
<?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->selectDataQuery($query);
$numRows = $data->getAffectedRows();
if($numRows > 0){
?>
<?php
}if ($numRows == 0) {?>
Sometext
<?php
}
} else
echo "<meta http-equiv='refresh' content='1; URL=../index.php'>";
?>
JQUERY:
<!--
$(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;
});
//-->
My code deletes ONLY the first row... How can I refer to the proper td values? And pass them to the ajax?
EDIT: I'm getting this error: TypeError: object is not a function [http://127.0.0.1/somesite/index.php?page=consAlerts:[35]
The error refers to the bellow code:
$.post("validaConsApagar.php", { estacao:$(this)(".estacaoCons").val(), grandeza:$(this)(".grandezaCons").val()}, function(data){...
So this is not a function that means that the syntax is wrong?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)