tags:

views:

43

answers:

1

Hello! Here is my code :

<script type="text/javascript">

    function 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!

A: 

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

jAndy
it seems to be working now. I guess a browser specific problem :O .Works just fine on FireFox
Anant
@Anant: Possible, that's why I mentioned the bad place at `body.onload`. jQuerys `.ready()` normalizes through all browser a reliable method.
jAndy