Hi all Im trying to pass form data and an additional variable using an AJAX call as seen below:
function tempFunction(obj) {
var data = $('form').serializeArray();
data.push(
{
no: $(obj).attr('id')
}
);
$.ajax({
type: "POST",
url: "/tempproject/main/changepage",
data: data,
success: function (msg) {
alert(msg);
}
});
}
however in PHP when I try and call back the 'no' variable I am getting an error saying undefined index. within my php file I am trying:
$test = $_POST['no'];
echo $test;
when clicking I receive a popup that says undefined index no.