AJAX Call to PHP file: return value is empty

后端 未结 2 560
一向
一向 2021-01-23 12:39

I have a simple ajax call:

function init() {
    $.ajax({
        url: \"./myFolder/user.php\",
        data: {
            action: \"init\"
        },
        t         


        
2条回答
  •  不知归路
    2021-01-23 13:25

    On user.php page you need to do :-

    function init() {
            $arr = array(
                array(
                    "region" => "valore",
                    "price" => "valore2"
                ),
                array(
                    "region" => "valore",
                    "price" => "valore2"
                ),
                array(
                    "region" => "valore",
                    "price" => "valore2"
                )
            );
    
            echo  json_encode($arr);
        }
    

提交回复
热议问题