然后: if(myXHR.getResponseHeader(''Allow'')。lastIndexOf(''EDI TING'')!= -1){ // show"编辑"按钮 } 修改服务器端脚本以发送 附加允许是一个琐事。可编辑内容的响应标题。I would go with the response headers. On practice I am regularly using"Allow" header for similar purposes. The benefits are that this headeris explicitly forbidden for modifications by proxy servers and usefulto store proprietary info. In the case of a simple yes/no flag it isenough to send a regular set for the content allowed to be edited:Allow: HEAD, GET, POSTIn this case the presence itself of such header would mean "yes":if !!(myXHR.getResponseHeader(''Allow'')) {// show "Edit" button}Maybe an explicit keyword would be still more clean and secure:Allow: HEAD, GET, POST, EDITINGand then:if (myXHR.getResponseHeader(''Allow'').lastIndexOf(''EDI TING'') != -1) {// show "Edit" button}It would be a trivia to modify your server-side script to sendadditional "Allow" response header for editable content. 这篇关于另一个AJAX问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-02 04:54