Every time I do an Ajax request, I want server to check if number is 1, 3 or 5, and depending on result, echo out answer. The problem is, I get no data
in my alert();
. Here's my code:
ajax:
ajaxNumber= $.ajax({
url: "operations.php",
type: "post",
data: ile,
success: function(data){alert(data);}
});
PHP:
if(isset($_POST['ile'])) {
$numer = intval($_POST['ile']);
if($numer==1|$numer==3|$numer==5) {
echo "ok";
} else {
echo "ERROR";
}
}
alert();
is being displayed, but it's just empty.
EDIT: Running operations.php
on my own and giving $_POST['ile'] an existing value echos out me good responses.