Access json data from php

前端 未结 3 1886
野性不改
野性不改 2021-01-17 00:32

I have a problem accessing JSON data. I\'m new to JSON and jquery so there is probably a easy solution to it and I would be glad to find out.

My jQuery:



        
3条回答
  •  Happy的楠姐
    2021-01-17 01:08

    I could be wrong, but I don't think the post method assumes a data return-type of json. You could set that by changing the ajax function to:

      $.post(
        "currentPage.php",
        { 
        'currentPage': 1
        },
        function(data){
          $("body").append(data);  
        },
        "json"
      );
    

提交回复
热议问题