我怎样才能通过AJAX更新输入文本的价值? [英] how can I update value of input text via ajax?
本文介绍了我怎样才能通过AJAX更新输入文本的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想有
- 在输入文本框,我可以
- 在更新它的值与AJAX调用(获取当前版本),然后
- 在另一个按钮(更新code基)再拍AJAX调用在文本框中的值
我不知道如何这一切结合在一起。
<形式的行动=upgage.php>
修订<输入类型=文本名称=版本值=/>< BR />
<输入类型=提交值=更新code基地/>
<输入类型=提交值=获取当前版本/>
< /形式GT;
我想只使用JavaScript的不是jQuery的
解决方案
<脚本>
的document.getElementById('getValueButton')。的onclick =函数(){
。的document.getElementById('revisionTextField')值= getRevisionViaAjax();
}
< / SCRIPT>
I want to have
- an input text box that I can
- update its value with AJAX call ('get current revision') and then
- another button ( "update code base" ) to make another AJAX call the value in the text box
I do not know how to combine all this together.
<form action="upgage.php">
revision <input type="text" name="revision" value="" /><br />
<input type="submit" value="update code base" />
<input type="submit" value="get current revision" />
</form>
I would like to use only javascript not jQuery
解决方案
<script>
document.getElementById('getValueButton').onclick = function() {
document.getElementById('revisionTextField').value = getRevisionViaAjax();
}
</script>
这篇关于我怎样才能通过AJAX更新输入文本的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文