ajax GET failing when JSON content over 1MB on GoDaddy host

后端 未结 1 1881
粉色の甜心
粉色の甜心 2021-01-15 05:04

I have a very simple ajax GET request in jquery that works just fine on my local test server. If I move the web page to a hosted server (GoDaddy) along with the php service

相关标签:
1条回答
  • 2021-01-15 06:06

    Well I stumbled onto a solution. It was to add a header statement just before the echo which seems to allow the echo to be larger than 1MB.

    header("Content-Type: application/json");
    echo json_encode(array(array("date_code" => $ftime), $chargers));
    

    I now need to understand this more and check it across various browsers. Also interesting that the data was returned as an object now so no need to do json decode on it.

    I suspect there is something in the GoDaddy service that defaulted the length but I am not sure. Again my server did not behave this way.

    0 讨论(0)
提交回复
热议问题