设置来自ajax的隐藏输入值的值 [英] set value of hidden input value from ajax
本文介绍了设置来自ajax的隐藏输入值的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的ajax请求以一个newtimestamp变量作为响应,该变量需要在隐藏的输入字段时间"中设置.
My ajax request responds with a newtimestamp variable that I need to set on the hidden input field 'time'.
我已经尝试过了:
$("#time").value(data.newtimestamp);
但是这显示了此错误:
Uncaught TypeError: undefined is not a function
html:
<input type="hidden" value="<?php echo "$timestamp"; ?>" name="time" id="time" />
推荐答案
jQuery方法是val()
,而不是value()
:
The jQuery method is val()
, not value()
:
$("#time").val(data.newtimestamp);
这篇关于设置来自ajax的隐藏输入值的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文