Automatically update $ _SESSION variables without updating
I am using the $ _SESSION variable to send emails via AJAX (they need to be sent without refreshing the page), but the $ _SESSION variable is not automatically updated, so when it changes I need to refresh the page before updating the variable.
Is it possible to update the $ _SESSION variable without updating?
This is the code I am using to send email:
$(document).ready(function(){
$("#medicalembassy").validate({
debug: false,
rules: {
name: "required",
email: {
required: true,
email: true
}
},
messages: {
name: "Please let us know who you are.",
email: "",
},
submitHandler: function(form) {
// do other stuff for a valid form
$.post('http://www.example.co.uk/erc/process.php?imei=<?php echo $_SESSION['imei2']; ?>&send_type=2', $("#medicalembassy").serialize(), function(data) {
$('#results').html(data);
});
}
});
});
This way, if the $ _SESSION variable changes, I need this AJAX email to recognize it without having to update.
Thanks for any help
source to share
The variable A $ _SESSION is obtained by running "session_start ();" and cleared if you use "session_destroy ();". However, you cannot get changes in session variables multiple times in the same document: the document that requests AJAX will see the changes in $ _SESSION every time that page was requested (a page inside AJAX).
source to share