<script type="text/javascript">
f开发者_开发知识库unction show() {
var text=$("#text").val();
$("#output").load("index.htm");
}
function send() {
var text=$("#text").val();
$.post("new.php",{'txt':text});
$("#text").val(" ");
}
</script>
</head>
<body onload="javascript:window.setInterval('show()', 1000)">
<input type="text" id="text">
<div id="output">CHange</div>
<input type="button" value="Send" onclick="send()">
</body>
Now the problem i'm facing is that $("#output").load("index.htm");
doesn't seem to do anything :/
Please Help!
Try to use clean unobtrusive code. body.onload
is also a pretty questionable place to execute some code.
$(document).ready(function(){
show();
});
should do it. I'm not sure why you would call that within an ´interval` ?
精彩评论