Ask your JavaScript questions! Pay money and get answers fast! (more info)

"post reply" link no longer works? JavaScript

  • SOLVED

I am having this problem in both Chrome and FireFox on a Macintosh. Is anyone else having this problem?

I think the "post reply" link, on this site, just broke, during the last few days? I'm trying to respond to people in the other active thread, and when I click "post reply" the reply box opens and closes, almost as if I just clicked the link, and then clicked it again. See screenshot.

Any thoughts about what is causing this?

I see no errors in the FireBug console.

The only change I have made to the Javascript (in months) has been the inclusion of the Ajax call that pings TailorMadeAnswers.com:

<script type="text/javascript">
function i_am_logged_in() {
jQuery.ajax({
url: "http://www.tailormadeanswers.com:40000/",
data: {
username: "lawrence",
first_name: "Lawrence",
last_name: "Krubner",
user_image: "lawrence_phpcev4Z5.jpeg",
site: "www.javascriptquestions.com"
}
});
}
jQuery(document).ready(function($) {
i_am_logged_in();
setInterval("i_am_logged_in()", 8000);
who_is_logged_in();
setInterval("who_is_logged_in()", 8000);
});
</script>


I don't see that as likely to break anything.


Answers (3)

2012-10-20

Christianto answers:

Lawrence,

Is this happen only on javascriptquestions.com?
Because on this site I saw 2 different js files from different url that almost identical.

http://tailormadeanswers.com/javascript_for_tma_websites/wpquestions.js
http://javascriptquestions.com/globals/js/wpquestions.js

Both contain this code:
$('div.answer a.answer_thread_reply_link').each(function() {
$(this).click(function() {
var relId = $(this).attr('rel');
var idOfHiddenDiv = "answerExpanded-section" + relId;
$('#' + idOfHiddenDiv).toggle("slow");
var currentUrl = location.href;
// remove the anchor attached the last time someone clicked on something
var locationOfAnchor = strpos (currentUrl, "#");
if (locationOfAnchor > 0) currentUrl = substr(currentUrl, 0, locationOfAnchor);
var urlWithAnchor = currentUrl + "#" + idOfHiddenDiv;
location.href = urlWithAnchor;
return false;
});
});


I think it get fire twice because of this duplication.
it bind the event twice to same element.


Lawrence Krubner comments:

Nice catch! I made the change and uploaded it to the server and now everything is fixed! And I am using the 'post reply' box to reply to you. Nice job!

2012-10-20

Utkarsh Kukreti answers:

That cannot break it.

Possible to get access to an account which has posted a question, so I can test the "Reply" button? On a test site perhaps?

2012-10-20

Ross Wilson answers:

Can you post the code that opens the reply box?