php json_encode not returning proper json encoded string

前端 未结 2 1457
耶瑟儿~
耶瑟儿~ 2021-01-20 12:54

I am using a jquery ajax call which accepts json response :

 var posturl = \'/admin/getparamdetails/\';
    var data = \"adnetworkId=\"+adnetworkId;
    $.a         


        
2条回答
  •  迷失自我
    2021-01-20 13:33

    you have to send the data as Content-Type "application/json", otherwise it won't work.

    Just add the following in your PHP File:

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

提交回复
热议问题