简体   繁体   中英

Ajax returning an empty array?

I am trying to get some data however AJAX is just returning empty array.

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));

user_profile_upload.php use echo

<?php
  //echo $_POST; //return array, response in javascript file
  echo $_POST['data'];
?>

AJAX remove this

processData:false, 
contentType:false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM