Can't get json data from jQuery ajax call

后端 未结 5 1119
深忆病人
深忆病人 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:05

    Also you can use this mechanism:

    $.getJSON( "data.php", function( response ) {
        jsonData = response;
    });
    

    It is more clean if you want get only JSON :)

提交回复
热议问题