jQuery $.getJSON works only once for each control. Doesn't reach the server again

前端 未结 4 2019
Happy的楠姐
Happy的楠姐 2021-02-04 13:40

First my code

$.getJSON(\"./posts/vote/\" + postId + \"/1\", null, function(result) {
   if (result.result == true)
      $(\"#pst\" + postId + \" > .pstside          


        
4条回答
  •  猫巷女王i
    2021-02-04 14:24

    Since you are doing a "GET", it doesn't sound unreasonable that some caching (at the browser, a proxy / intermediary, or the server) could be the issue. Perhaps try using a "POST" if you are changing data ("keeps returning the old values"). Or introduce some random component into the query.

提交回复
热议问题