开发者

jQuery .load problem

开发者 https://www.devze.com 2023-01-11 02:08 出处:网络
<script type=\"text/javascript\"> f开发者_开发知识库unction show() { var text=$(\"#text\").val();

<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` ?

0

精彩评论

暂无评论...
验证码 换一张
取 消