我正在尝试获取一些数据,但AJAX只返回空数组。
AJAX:
$.ajax({
url:"user_profile_upload.php",
type: "POST",
data: { data : 'sss'},
contentType:false,
cache: false,
processData:false,
success:function (data) {
console.log(data);
}
});
user_profile_upload.php PHP:
die(print_r($_POST,true));
答案 0 :(得分:-1)
user_profile_upload.php 使用echo
<?php
//echo $_POST; //return array, response in javascript file
echo $_POST['data'];
?>
AJAX 删除此
processData:false,
contentType:false