0
嗨我有一个div,我每隔15秒重新加载PHP和AJAX的麻烦。它工作正常,但我想知道的唯一的事情是,如果可以加载输入文本,并且间隔刷新div不刷新输入文本,有时当您在输入中写入时,它只是重新加载,而您必须重新写入。输入文字重新加载间隔
这里是代码的某些部分: 文件1,我通过AJAX的内容加载到一个div:
<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
$.ajaxSetup({ cache: false }); // This part addresses an IE bug. without it, IE will only load the first number and will never refresh
setInterval(function() {
$('#precio').load('valoractual.php');
}, 15000); // the "3000" here refers to the time to refresh the div. it is in milliseconds.
});
// ]]></script>
下面是重载的形式:在先进的
<p>Current Bid: <?php echo "USD ".$puja; ?></p>
<p><form id="bid" name="bid">
<input type="text" name="puja" placeholder="<?php $sobrepujar = $puja + 500; echo $sobrepujar; ?>" id="puja" size="14" /><input type="hidden" id="usuario" value="<?php echo $_SESSION['idusuario']; ?>" /><input type="hidden" id="valoractual" value="<?php echo $puja; ?>" /><input type="hidden" id="idpuja" value="<?php echo $idpuja; ?>" /> <input type="button" id="submit" value="B I D"/>
</form>
谢谢!
它doesn't加载该文件作为#puja是在要加载的文件和脚本是主要的 – Agustin 2014-10-29 20:25:57
更新了答案 – sventschui 2014-10-29 20:29:01
谢谢你很多! – Agustin 2014-10-29 20:59:31