[英]how can I update value of input text via ajax?
I want to have 我希望有
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 我想只使用javascript而不是jQuery
<form action="upgage.php">
<input type="submit" id="revision"/> <input type="text" id="passedValue" value="" /><br />
<input type="submit" value="update" />
</form>
now in jQuery: 现在在jQuery中:
$("#revision").click(function(event) {
event.preventDefault();
$.post("/my/url/", function(data) {
$("#passedValue").val(data);
});
});
Hope I understood you correctly :P 希望我理解你:P
<script>
document.getElementById('getValueButton').onclick = function() {
document.getElementById('revisionTextField').value = getRevisionViaAjax();
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.