Is it possible to access $_POST variables without appending all the form elements into the data attribute?
Ajax call:
$.ajax({
type: "POST",
url: "ajax/user.php",
data: {**data**},
success: this.saveUserResponse
});
Accessing variables:
if(isset($_POST['saveUser']) && $_POST['saveUser']){
$user = $_POST['username'];
...
...
exit;
}
Or do i need to append all form elements to the data attribute, like:
var userId = $('#userId').val();
$.ajax({
type: "POST",
url: "ajax/user.php",
data: {user : userId, etc... },
success: this.saveUserResponse
});
Thanks for your help