NSW42 Posted April 24, 2011 Share Posted April 24, 2011 Hey I have a comment script coded in jquery similar to fb one, it works perfect etc, but I just added in a jquery timer so it updates the div for recent posts and again that works fine, but what it does when the code is added, it blocks a user from commenting or deleting anything. <script> $(document).ready(function() { $("#responsecontainer").load("index.php"); var refreshId = setInterval(function() { $("#responsecontainer").load('index.php?randval='+ Math.random()); }, 9000); $.ajaxSetup({ cache: false }); }); </script> The below part goes in the body and is the one causing the issue, i'm new to jquery so please take it easy on me many thanks. <div id="responsecontainer"> Quote Link to comment https://forums.phpfreaks.com/topic/234547-jquery-blocking-script/ Share on other sites More sharing options...
NSW42 Posted April 25, 2011 Author Share Posted April 25, 2011 I should be a bit more clear on what is happening, it is blocking values from the other script from showing and this is only when it does a refresh. Quote Link to comment https://forums.phpfreaks.com/topic/234547-jquery-blocking-script/#findComment-1205795 Share on other sites More sharing options...
NSW42 Posted April 27, 2011 Author Share Posted April 27, 2011 Ok will post one last time before I finally give up on this, below is the other jquery script and the timer below that, as I stated prior, on refresh the values from the main jquery script aren't shown any longer nor can anyone comment post or delete anything, just remember this only happens once the contents refreshs, if I cant get it fixed the the whole project is useless to me, so I hope someone can help. <script type="text/javascript"> // <![CDATA[ $(document).ready(function(){ $('#shareButton').click(function(){ var a = $("#watermark").val(); if(a != "What's on your mind?") { $.post("posts.php?value="+a, { }, function(response){ $('#posting').prepend($(response).fadeIn('slow')); $("#watermark").val("What's on your mind?"); }); } }); $('.commentMark').livequery("focus", function(e){ var parent = $(this).parent(); $(".commentBox").children(".commentMark").css('width','320px'); $(".commentBox").children("a#SubmitComment").hide(); $(".commentBox").children(".CommentImg").hide(); var getID = parent.attr('id').replace('record-',''); $("#commentBox-"+getID).children("a#SubmitComment").show(); $('.commentMark').css('width','300px'); $("#commentBox-"+getID).children(".CommentImg").show(); }); //showCommentBox $('a.showCommentBox').livequery("click", function(e){ var getpID = $(this).attr('id').replace('post_id',''); $("#commentBox-"+getpID).css('display',''); $("#commentMark-"+getpID).focus(); $("#commentBox-"+getpID).children("img.CommentImg").show(); $("#commentBox-"+getpID).children("a#SubmitComment").show(); }); //SubmitComment $('a.comment').livequery("click", function(e){ var getpID = $(this).parent().attr('id').replace('commentBox-',''); var comment_text = $("#commentMark-"+getpID).val(); if(comment_text != "Write a comment...") { $.post("add_comment.php?comment_text="+comment_text+"&post_id="+getpID, { }, function(response){ $('#CommentPosted'+getpID).append($(response).fadeIn('slow')); $("#commentMark-"+getpID).val("Write a comment..."); }); } }); //more records show $('a.more_records').livequery("click", function(e){ var next = $(this).attr('id').replace('more_',''); $.post("posts.php?show_more_post="+next, { }, function(response){ $('#bottomMoreButton').remove(); $('#posting').append($(response).fadeIn('slow')); }); }); //deleteComment $('a.c_delete').livequery("click", function(e){ if(confirm('Are you sure you want to delete this comment?')==false) return false; e.preventDefault(); var parent = $(this).parent(); var c_id = $(this).attr('id').replace('CID-',''); $.ajax({ type: 'get', url: 'delete_comment.php?c_id='+ c_id, data: '', beforeSend: function(){ }, success: function(){ parent.fadeOut(200,function(){ parent.remove(); }); } }); }); /// hover show remove button $('.friends_area').livequery("mouseenter", function(e){ $(this).children("a.delete").show(); }); $('.friends_area').livequery("mouseleave", function(e){ $('a.delete').hide(); }); /// hover show remove button $('a.delete').livequery("click", function(e){ if(confirm('Are you sure you want to delete this post?')==false) return false; e.preventDefault(); var parent = $(this).parent(); var temp = parent.attr('id').replace('record-',''); var main_tr = $('#'+temp).parent(); $.ajax({ type: 'get', url: 'delete.php?id='+ parent.attr('id').replace('record-',''), data: '', beforeSend: function(){ }, success: function(){ parent.fadeOut(200,function(){ main_tr.remove(); }); } }); }); $('textarea').elastic(); jQuery(function($){ $("#watermark").Watermark("What's on your mind?"); $(".commentMark").Watermark("Write a comment..."); }); jQuery(function($){ $("#watermark").Watermark("watermark","#369"); $(".commentMark").Watermark("watermark","#EEEEEE"); }); function UseData(){ $.Watermark.HideAll(); //Do Stuff $.Watermark.ShowAll(); } }); // ]]> </script> <script> $(document).ready(function() { $("#responsecontainer").load("index.php"); var refreshId = setInterval(function() { $("#responsecontainer").load('index.php?randval='+ Math.random()); }, 60000); $.ajaxSetup({ cache: false }); }); </script> <div id="responsecontainer"> Quote Link to comment https://forums.phpfreaks.com/topic/234547-jquery-blocking-script/#findComment-1206709 Share on other sites More sharing options...
NSW42 Posted April 27, 2011 Author Share Posted April 27, 2011 Ok I did a cross browser check and it seems to work fine in IE, but the refresh issue remains the same in in other none MS browsers. Quote Link to comment https://forums.phpfreaks.com/topic/234547-jquery-blocking-script/#findComment-1206748 Share on other sites More sharing options...
NSW42 Posted May 16, 2011 Author Share Posted May 16, 2011 Anyone able to help on this issue at all. Quote Link to comment https://forums.phpfreaks.com/topic/234547-jquery-blocking-script/#findComment-1215916 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.