[英]Loading an input value from another page using JQUERY load function
Please guys is there a way i can make a value of the submit button to be loaded automatically from another page using the jquery .load
function: 大家好,有一种方法可以让我使用jquery
.load
函数从另一个页面自动加载提交按钮的值:
<input type="submit" id="submit" value="(JQUERY LOADED PAGE VALUE HERE)" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
setInterval(function () {
$('#submit').load('page.php')
}, 500);
});
<script>
将其更改为.get()并使用回叫
$.get('page.php', function(data) { $('#submit').val(data); });
You can use normal ajax for this. 您可以为此使用普通的ajax。
.load()
is supposed to load HTML content. .load()
应该加载HTML内容。
<input type="submit" id="submit" value="(JQUERY LOADED PAGE VALUE HERE)" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
setInterval(function () {
$.ajax({
url : 'page.php',
success : function(data){
$('#submit').val($.trim(data));
}
});
}, 500);
});
<script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.