I'm storing different values in the sessionStorage during a longer process. At the end i want to read all the data and send it to my php backend using ajax. The problem is that php seems to take every value including quotes. Here is what i got:
// Reading data from storage
var imgb = sessionStorage.getItem("img_b_id");
....
// perpare data
var oData = {
imgb: imgb,
...
};
// Sending data
$.post( "../php/direct/create.php", oData).done(function(data) {
if(data==true) {
window.open("step5.php", "_self");
} else {
alert("Error: " + data.toString());
}
});
This is working perfectly fine. However, php will read the value of imbg with quotes. Example:
echo $_POST['imgb'];
/* Returns "asd" instead of asd
The image below shows that my data is stored without the quotes (chrome sessionstorage screenshot)
Do you have any suggestions on how to solve this. I currently replace the quotes, but I'd love to fix this problem at it's root...