i need to transfer a variable from js to a php page then insert it in the database
the Js code
function tableText(tableCell) {
var x =tableCell.innerHTML;
console.log(x);
}
also tried the ajax
function tableText(tableCell) {
var x =tableCell.innerHTML;
console.log(x);
$.ajax({
type: 'POST',
url: 'try.php',
data: x ,
complete: function(text){
return text; }
});
}
not sure if i got it right and i don't know how to call it in the php page
so How to get variable from JavaScript to PHP ??