views:

17

answers:

0

Hello. I have this for inserting a comment:

<script type="text/javascript">
function onInsertComplete(data,textstatus){
    $("#insert_response").html(data);
        if ($("#box[value=1]").length > 0) {  
        window.parent.showMessage("Video Is OK"); 
    }
}

function DoInsert(){
    $("#insert_response").html("To Sek...");
    var nocache = '0';
    var data = { fID : $("#fID").val(), kommentar: $("#kommentar").val(), nocache: nocache };
    $.get('insert.php', data, onInsertComplete);
}
</script>

at the same page where the form to comment is in.. now ive included a js file called ajax_framework.js, and inside it there is this function:

function ajax_update()  { 
        var aID = document.getElementById('flibberdegibbet');
        var postFile    =   'showcomments.php?id='+ aID.value;
  $.post(postFile, function(data){
    $("#wtf").html(data); 
    setTimeout(ajax_update, 2000);
  });
}    

Now this function stops refreshing, after you have inserted a comment twice?

Yea it sounds funny, for me at least, but i dont really know WHY it stops refreshing after you second comment? It does insert the comment you make, but it doesnt refresh like it does at the beginning..

Response that displays in insert_response is: Commented sucessfull

<input type="hidden" id="flibberdegibbet" value="<? echo $_GET['id']; ?>">