2 回答
1
正如 FryGuy 所说,$.post 方法可能是你最好的选择,尽管我会这样安排:
$("#project select").change(function(){ // use one selector for all 3 selects
$.post("someurl.php",{
// data to send
completed: $("select#completed").val(),
hours: $("select#hours").val(),
who: $("select#who").val()
}, function(data) {
// do callback stuff with the server response 'data' here
});
});
如果三个选择在页面上多次出现,这可能不是您想要的。我建议通读 jquery 文档以处理事件。至于提取数据,您只需要在需要它们的时候使用选择器和方法,如, .text(),.val()等。你想要的信息总是在 DOM 的某个地方。.html().attr()
于 2009-01-23T11:38:43.840 回答
0
我会使用jQuery post 方法.. 类似:
$.post("updater.php", { completed: variableWithCompletedFromSelect } );
只需在 select 的 on change 事件中调用它,然后传入 select 的值。然后您的 php 脚本将具有新值的 $_POST['completed'] 。
于 2009-01-23T02:23:38.283 回答