Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send multiple variables in jeditable?

i'm quite new to jquery and right now, im using jeditable to let the user edit some information on my webpage.

So here's my problem, How do you send multiple variables to the php file using jeditable? i understand that when the user clicks the submit button, the id and value will be POST-ed to the php file.

so let's say i have this code:

var x = 1;
var y = 2;

$('.edit_area').editable('test.php', {
    type      : 'textarea', 
    cancel    : 'Cancel',
    event     : "dblclick",
    submit    : 'OK',
    indicator : '<img src="img/loading.gif">',
    tooltip   : 'Click to edit...'
});

how can i send the x and y variables to test.php when the user clicks the OK button in jeditable? thanks

like image 681
Kevin Carlo Salanga Uy Avatar asked Mar 14 '13 13:03

Kevin Carlo Salanga Uy


1 Answers

This post is very old but I stumbled upon it. Maybe this will help somebody. A short look at the documentation would have told you this:

"(Mixed) submitdata: Extra parameters when submitting content. Can be either a hash or function returning a hash."

$(".editable").editable("http://www.example.com/save.php";, {
   submitdata : {foo: "bar"};
});

So in your case you would just add the extra parameter "submitdata" like this:

submitdata : {x: x, y: y};

If the user clicks the OK button now, the values of x and y would be posted to the server.

like image 52
morten.c Avatar answered Sep 21 '22 15:09

morten.c