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 8443617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:11:13+00:00 2026-06-10T09:11:13+00:00

I have this function, that it’s part of my game, and which sends the

  • 0

I have this function, that it’s part of my game, and which sends the data to the getScore.php. And in that php I have some code that sends me back the score for every tag that the player enter, like this “100” “50” or “10.
Now I want to grab those scores and sum them and keep showing the player his score (updating), until the game is over.

function showScore() {
    $.ajax({
        type: "GET",
        url: "getScore.php",
        data:{
            tag: $("#tag").val(),
            timecode: curTime,
            filename: getFileName(),
            gameid: gameID()
        }
    }).done(function( msg )
    {
    show3(msg);

    });

    return false; 
};

The last function is where I show the score, but now I want to change it for sum and show.
How can I do this?!

var score;

function show3(string)
{
document.getElementById('myScore').innerHTML = string;
return string;
}
  • 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-06-10T09:11:14+00:00Added an answer on June 10, 2026 at 9:11 am

    i’m guessing you want to add the score you get from myScore.php to score and display it. The parseInt() function should do the trick:

    function show3(msg)
    {
    score = score+parseInt(msg);
    document.getElementById('myScore').innerHTML = score;
    return score;
    }
    

    firstly, naming the var and the function parameter score is confusing you. Secondly,you weren’t adding the score you got from getScore.php you’re replacing it.

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

Sidebar

Related Questions

I have this function that puts some data with Ajax call in a php
I have this Javascript function that sends username and password to php file through
I have this function that takes some user-submitted HTML code from the database: function
I have this function that I would like to condense into some iterator. How
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
i have this function that brings me back a value by query a table
I have this function that I wrote that is abysmally slow since php does
So i have this function that parses data from an url string and set
I am learning assembly and I have this function that contains some lines I
I have this function $.fn.validate.checkValidationName = function(id) { $.post(PHP/submitButtonName.php, {checkValidation: id}, function(data) { if(data.returnValue

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.