问题描述
我有两个PHP文件来管理服务器上的文件:
list.php
delete.php
文件list.php显示服务器特定目录中的文件列表。它使用表来列出文件。表中的一列名为删除此文件。如果您在一行中单击该列,则文件delete.php将被删除。将调用一个参数。它将删除通过地址栏参数传递给它的文件。
这是一个简单的例子list.php
I have two PHP files to manage my files on a server:
list.php
delete.php
The file "list.php" shows a list of files in a specific directory of server. It uses a table to list the files. One of the columns in the table is named "Delete this file". If you click on that column in a row, the file "delete.php" with an argument will be called. It will delete the file passed to it through address bar arguments.
This is an easy example of "list.php"
推荐答案
jQuery只是一组预定义的JavaScript函数(= library)。除此之外,jQuery和JavaScript之间没有区别。
AJAX只是一种设计模式(使用特殊对象),但就是这样。您可以将其想象为后台HTTP请求。
jQuery is just a predefined set of JavaScript functions (= library). other than that there is no difference between jQuery and JavaScript.
AJAX is merely a kind of Design Pattern (which uses a special object), but that?s it. you can imagine it as a background HTTP Request.
这就是你怎么做的。只是读了一些不太旧的AJAX教程来掌握它。
注意:我使用头来传达删除成功(如果删除成功,则使用HTTP 200或204)如果删除失败,则为HTTP 500)
that?s exactly how you would do it. just read some not too old AJAX tutorials to get the hang of it.
note: I?d use headers to communicate the deletion success (i.e. HTTP 200 or 204 if the deletion succeeded and a HTTP 500 if the deletion failed)
这篇关于如何Ajax启用此代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!