First of all I must say that I'm new to AJAX. So the question would sound dumb for most of them But the I would really appreciate any kind of help in this I have been trying to add make an AJAX get request and pass some parameter in the header which fails for some reason. I know its very basic an issue but I have been searching for a fix for the past 4 hours and couldn't find the right solution
function resetSession() {
$.ajax({
dataType: "text",
beforeSend: function (request)
{
request.setRequestHeader("sessionVariable", sessionVariable);
},
url: "/reset.php",
type: "GET",
success: function(data) {
alert("yes");
},
error: function(data){
alert("no");
}
});
}
I dont see any issues with this code and I did look for a different one that fixes it for me and couldn't find it Every time the function is called the request URL is right but request method is OPTIONS
Looking forward to an easy fix thanks in advance