简体   繁体   中英

Using submitdata in Jeditable and in save.php

I'm using Jeditable to edit columns. 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.

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. 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?

Currently in save.php I have;

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

But I don't understand how to pick up the values of foo and 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. I believe the variables are passed thru the $_REQUEST array so in your php file:

$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. With a static value it is:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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