简体   繁体   English

在Jeditable和save.php中使用Submitdata

[英]Using submitdata in Jeditable and in save.php

I'm using Jeditable to edit columns. 我正在使用Jeditable编辑列。 But during the edit for one particular column I need to send some additional information with the post. 但是在编辑一个特定列的过程中,我需要在帖子中发送一些其他信息。 To do this I included the submitdata: as seen below. 为此,我包括了submitdata:如下所示。

var foo = 12;  var foo2 = 'ABBOT';

$(document).ready(function() {
    $('.edit').editable('save.php', {
        indicator : "Saving...",
        tooltip   : '',
        style     : "inherit",
        submitdata: function(value, settings) {
            return {
                foo: netID, 
                foo2: cs1
            };
        }
    });

The data for foo and foo2 is created in a var foo = 12 and var foo2 = 'ABBOT' (netID and cs1) step above the editable function. foo和foo2的数据在var foo = 12var foo2 = 'ABBOT' (netID和cs1)的可编辑函数上方创建。 My question is two fold: One is this the correct syntax to pass those values? 我的问题有两个:一个是传递这些值的正确语法吗? Two, in save.php how do I receive those values? 二,在save.php中如何接收这些值?

Currently in save.php I have; 目前在save.php中;

$rawdata = file_get_contents('php://input');

But I don't understand how to pick up the values of foo and foo2. 但是我不明白如何选择foo和foo2的值。

If you can and are willing please help me understand how to do this. 如果可以,请帮助我了解如何执行此操作。

I am new to jquery but have been trying out jeditable. 我是jquery新手,但一直在尝试jeditable。 I believe the variables are passed thru the $_REQUEST array so in your php file: 我相信变量是通过$ _REQUEST数组传递的,因此在您的php文件中:

$val1 = $_REQUEST['foo'] ;
$val2 = $_REQUEST['foo2'] ;
echo $val1;
echo $val2;
// prints out 12 & ABBOTT

I too am stuck on how you pass a variable thru submitdata option. 我也对如何通过submitdata选项传递变量感到困惑。 With a static value it is: 静态值是:

submitdata : {foo: "12",
              foo2: "ABBOTT"
             }      

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM