how to clear the cache data when using ajax?

前端 未结 6 2154
星月不相逢
星月不相逢 2021-01-25 17:44

I am using Ajax to retrieve the data from server as below based on some ID to perform auto suggest function. however when i submit the form and update the database, the auto sug

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-25 17:50

    I had this problem once before. This is probably something you can fix in your server settings. What the server does is get a server request, build the answer, and when the same request is done again it sends the same response it built before.

    To easily avoid this problem, I added an extra request parameter (a UID). so:

    xmlhttp.open("GET","gethint.php?q="+str+**"?something"=RANDOMGUID**,true);
    

    this way you always ha a unique request.

提交回复
热议问题