jQuery won't actually delete anything. If you want to really remove items, you'll have to do so at the source of the list. If your list is made up of static-HTML, you'll need a language like PHP that can access the raw-file and make changes. If your list is stored in a database, you'll need a server-side language like PHP or C# to make those changes.
jQuery can post data to server-side scripts that have the ability to remove/add/edit entries in a database. You might have a PHP script like the following:
if ($_POST) {
$favid = $_POST["favid"];
remove_favorite($favid);
}
jQuery could pass a favid to this script:
$.post("removefav.php", {favid:121});
This would post a variable to the server-side script, which would then take the value of that posted-variable and delete its corresponding record in the database.
This is a very crude example, but should suffice for getting you a bit more understanding of jQuery's relationship to server-side languages and databases.
发布评论
评论(2)
jQuery 实际上不会删除任何内容。如果您想要真正删除项目,则必须在列表的源头执行此操作。如果您的列表由静态 HTML 组成,您将需要 PHP 等可以访问原始文件并进行更改的语言。如果您的列表存储在数据库中,您将需要 PHP 或 C# 等服务器端语言来进行这些更改。
jQuery 可以将数据发布到服务器端脚本,这些脚本能够删除/添加/编辑数据库中的条目。您可能有一个如下所示的 PHP 脚本:
jQuery 可以向此脚本传递一个 favid:
这会将一个变量发布到服务器端脚本,然后服务器端脚本将获取该发布变量的值并删除其在数据库中的相应记录。
这是一个非常粗略的示例,但应该足以让您更多地了解 jQuery 与服务器端语言和数据库的关系。
jQuery won't actually delete anything. If you want to really remove items, you'll have to do so at the source of the list. If your list is made up of static-HTML, you'll need a language like PHP that can access the raw-file and make changes. If your list is stored in a database, you'll need a server-side language like PHP or C# to make those changes.
jQuery can post data to server-side scripts that have the ability to remove/add/edit entries in a database. You might have a PHP script like the following:
jQuery could pass a favid to this script:
This would post a variable to the server-side script, which would then take the value of that posted-variable and delete its corresponding record in the database.
This is a very crude example, but should suffice for getting you a bit more understanding of jQuery's relationship to server-side languages and databases.