Please I am a newbie to Jquery and javascript however I am trying to parse a table name from jquery to a php page which which will be used to truncate a table. Please below is what I have tried so far...
Jquery page
$(function() {
$.winFocus(function(event, isVisible) {
if(isVisible){
var tableName="table1";
$("#isVisible").val(tableName);
}
else {
var tableName = "table2";
$("#isVisible").val("tableName");
}
});
})
The PHP form
//table name value from jquery
$tableName ='<div id="tableName"></div>';
// mysql query that truncates the table
$query = "TRUNCATE TABLE $tableName";
This does not give any error,yet it doesnt truncate the table. Please what am I doing wrong? Thanks for helping.