Well, the problem is not new, as I saw (really surf a lot), but still can not find solution for myself.
Description of problem:
- Have local Web server - XAMPP;
- Firefox 29.0.1
-
And trying to send POST with $.ajax
function checkUser(){ $.ajax({ type: 'POST', url: 'ajax/checkUser.php', data: 'uname='+$("#username").val()+'&pword='+$("#password").val(), success: function(){ someNewFunc(); }, }); };
This function I'm calling with:
$(document).ready(function(){
$(".button.postfix.login").on("click", function(){
if (($("#username").val() != "") && ($("#password").val() != "")) {
hide(); <-- hide pop ups about empty field
checkUser();
} else {$("#empty").show();} <-- pop ups
});
});
And here code of page with elements:
<input id="username" type="text" placeholder="Username" />
<input id="password" type="password" placeholder="Password" />
<a class="button postfix login" href="#"
onclick="event.preventDefault();">Sign in</a>
I guess that data are going out, but the page checkUser.php doesn't get anything. What am I doing wrong?
P.S. checkUser.php:
<?php
print_r($_POST);
?>
Result - Array ( )
P.P.S. By the way, if POST change to GET it's working, but need to be POST