How to assign javascript variable to php $_POST to get the data on same page.
i tried following
var t= timesheetId;//timesheet id is coming from js file
$.ajax({
type:"POST",
data: {'variable': t},
});
1 Answer 1
You need to add a url to that ajax request so that it sends it to wherever your php file is. right now it's not being sent anywhere
Sign up to request clarification or add additional context in comments.
Comments
default
.php-file separately. Specify aurl : "/phpfile.php",parameter too, where you then use$_POST['variable']in aphpfile.php