Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3276130
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:13:24+00:00 2026-05-17T19:13:24+00:00

Alright so pretty basic, here are the pieces of code I have, basically it’s

  • 0

Alright so pretty basic, here are the pieces of code I have, basically it’s supposed to updated my table “comments” on the “like” column. My problem is situated in the javascript while trying to submit the result.

SPAN which contains a link to submit:

<span id="like<?=$i?>"><a href="javascript:void()" onClick="likeComment(<?=$row[commentid]?>, <?=$i?>)" />Like</a> (<?=$row[like]?>)</span>

Basically commentid is the actual comment ID, and $i is the comment # (so when I submit the +Like it will actually update the right SPAN tag.

After that, I have my AJAX which will post it to my PHP file:

<script type="text/javascript">
function likeComment(id, no)
{
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("like"+no).innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","like_game.php?id="+id"&no="+no,true);
xmlhttp.send();
}
</script>

Basically it is supposed to submit the comment ID and the comment SPAN ID, so then my PHP file will return

<span id="like<?=$number?>"><font color="#009900">You like this</font> (<?=$row[like] + 1?>)</span>

(I didnt include the PHP, my issue isnt stiuated in there.

I don’t know what the problem is, but it wont work. When I do it with just one ID, it does work so in my opinion, there is a problem with either

 xmlhttp.open("GET","like_game.php?id="+id"&no="+no,true);

or

document.getElementById("like"+no).innerHTML=xmlhttp.responseText;

So bascially it is supposed to submit comment ID 60 for example, it is situated in the SPAN ID’d 5, so when it submits it, it should be supposed to return in the right ID.

Any help is appreciated, because I’m clueless here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:13:25+00:00Added an answer on May 17, 2026 at 7:13 pm
    xmlhttp.open("GET","like_game.php?id="+id"&no="+no,true);
    

    should be like:

    xmlhttp.open("GET","like_game.php?id="+id +"&no="+no,true);
    

    I am thinking you are missing one “+” in the line above 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
Alright, Here's the gist of what I'm planning to do. I'm going to have
Alright here's the situation, I have an application written in the Zend_Framework, that is
Alright, so warsow has some pretty excellent hud code with the exception that the
Alright, currently I have my SWF hitting a php file that will go and
Alright, I have been doing the following (variable names have been changed): FileInputStream fis
Alright. So I have a very large amount of binary data (let's say, 10GB)
Alright, I thought I understood generics pretty well, but for some reason I can't
Alright, this is probably gonna be a pretty simple question to answer. I haven't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.