i'm quite new to jquery and right now, im using jeditable to let the user edit some information on my webpage.
我对jquery很陌生,现在我用jeditable让用户在我的网页上编辑一些信息。
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.
这是我的问题,如何使用jeditable向php文件发送多个变量?我理解当用户单击submit按钮时,id和值将被post到php文件中。
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
如何发送x和y变量进行测试。当用户点击jeditable中的OK按钮时?谢谢
1 个解决方案
#1
6
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"就像这样:
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.
如果用户现在单击OK按钮,x和y的值将被发送到服务器。
#1
6
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"就像这样:
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.
如果用户现在单击OK按钮,x和y的值将被发送到服务器。