Can't get json data from jQuery ajax call

后端 未结 5 1142
深忆病人
深忆病人 2021-01-05 09:35

I\'m trying to get data from data.php via jQuery ajax call.

My code looks like this:

var jsonData;

$.ajax({
        url: \'data.php\',
         


        
5条回答
  •  没有蜡笔的小新
    2021-01-05 10:12

    data.php

    header('Content-type: application/json'); 
    

    and

    $.ajax({
            url: 'data.php',
            dataType: 'json',
            success: function(response) {
                jsonData = response;
            }
    });
    

提交回复
热议问题