在我的应用程序中,我需要通过对textbox keyup的ajax调用将一个参数传递给控制器。通过提交其工作,但我需要通过键盘和ajax是必须的。任何人请用小样本来解释
谢谢,
发布于 2009-07-23 21:41:33
如果你使用prototype,你可以这样做:
<input type="text" id="element_to_observe">
<script type="text/javascript">
Event.observe($('element_to_observe'), 'keyup', function(event) {
var element = Event.element(event);
new Ajax.Request('/controllerName/action/' + element.value, { // your argument
asynchronous :true,
onSuccess : doSomething, // your function to execute after response
evalScripts :true
});
});
function doSomething(response) {
}
</script>
https://stackoverflow.com/questions/1173650
复制相似问题