AJAX复选框 [英] AJAX Checkboxes

查看:109
本文介绍了AJAX复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用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.

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.

这篇关于AJAX复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆