Read/write to file using jQuery

后端 未结 7 1069
迷失自我
迷失自我 2020-11-22 13:29

Is there a way to get jQuery to get information to and from a file? Is it possible? How?

7条回答
  •  死守一世寂寞
    2020-11-22 13:57

    No, JavaScript doesn't have access to writing files as this would be a huge security risk to say the least. If you wanted to get/store information server-side, though, you can certainly make an Ajax call to a PHP/ASP/Python/etc. script that can then get/store the data in the server. If you meant store data on the client machine, this is impossible with JavaScript alone. I suspect Flash/Java may be able to, but I am not sure.

    If you are only trying to store a small amount of information for an unreliable period of time regarding a specific user, I think you want Web Storage API or cookies. I am not sure from your question what you are trying to accomplish, though.

提交回复
热议问题