jquery ajax php 数据交互
PHP 程序:public function checkUsername()
{
$username = $_POST['username'];
$this->ajaxReturn($username, '用户名已经存在');
}
jquery代码:
var username = $(this).val();
$.ajax({
type: 'post',
url: 'index.php/public/checkUsername',
data: 'username=' + username,
beforeSend: function() {
//alert('beforesend');
},
success: function(msg){
alert(msg);
}
});
问题: 这样写,不知道数据是否已经传到服务器端了,也不知道是否有数据返回,我初学jquery, 请大侠们指点!
页:
[1]