I'm sending data via ajax to my server (PHP), I'm setting the call to be a POST request, but somehow it doesn't work that way and works as a GET request, here's the code:
$.ajax({
type: 'POST',
data: {
user: user
},
url: url,
crossDomain: true,
contentType: "application/json; charset=utf-8",
dataType: 'jsonp',
success: function (data) {
alert(data);
},
error: function (error) {
alert(error)
}
});
PHP:
<?php
$user = $_POST["user"];
echo $user;
?>
That doesn't work, but if I change the $_POST to $_GET, it works great.
What is it that I'm doin wrong that the server intepretes GET and not POST as I want and as I'm setting it in the ajax call?