I'm getting undefined index(return data)
from this AJAX call. What am I doing wrong here? Please correct me.
$(document).ready(function() {
$('#something').click(function() {
edit(1, 'abc', 'xyz');
});
function edit(id, column, text) {
$.ajax({
url: "edit.php",
method: "POST",
data: {
id: id,
text: text,
column: column
},
dataType: "text",
success: function(data) {
console.log(data);
}
});
}
});
edit.php
echo $_POST["id"];
I'm getting this in the console:
Notice: Undefined index: id in C:\xampp\htdocs\datatable\edit.php on line 2