AJAX复选框复选框、AJAX

2023-09-10 19:05:18 作者:忘川

我已经使用PHP和JS服务器驱动的网站。一节显示,我们的用户上传的所有照片,和管理员,然后决定继续进行最后的presentation的照片。大部分网站用jQuery进行就地编辑,但这个任务我难住了。我想插入一行到一个MySQL数据库表的副本,一个复选框的点击照片等相关信息的网址... NO提交按钮。

我有我需要在foreach(水珠($迪尔))所产生的信息和旁边的每张照片生成我可以把复选框。

解决方案

  $('复选框,选择在这里)。绑定(点击,函数(){
    $阿贾克斯({
        键入:POST,
        网址:网址/到/ backend.page,
        数据:{数据字典},
        等等等等
    });
);
 

在后台页面,只是处理POST请求,并插入相应的MySQL的记录。

I have a server driven site using php and js. One section displays all photos that our users have uploaded, and an administrator then decides which photos to keep for final presentation. Most of the site uses jquery for inplace edits, yet this task has me stumped. I want to insert a row into a MySQL database table that copies the URL of the photo and other associated information with the click of a checkbox ...NO SUBMIT button.

php ajax复选框是否选中的值,如何用ajax提交复选框的值到后台

I have all the info I need generated in a foreach (glob($dir)) and beside each photo generated I can place the checkbox.

解决方案

$('checkbox selectors here').bind('click', function() {
    $.ajax({
        type: 'POST',
        url: url/to/backend.page,
        data: {dictionary of data},
        etc etc
    });
);

On the backend page, just handle the POST request and insert the appropriate MySQL records.

 
精彩推荐
图片推荐