I'm passing an object through ajax to a PHP file for processing like this:
var Obj = {id:1, name:"John", value:12.1};
$.ajax({
url : "myfile.php",
type : 'POST',
data : Obj,
success : function(data) {
console.log(data);
});
My issue is when I receive the parameters on my $_POST variable everything is a string like id => "1" or value => "12.1". I would like these to be kept like an Int and a Float for example without additional conversions on the PHP side.
Is there an easy way to maintain the variable types?