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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:43:42+00:00 2026-06-05T11:43:42+00:00

I have a php page which includes jQuery and a script.js file. When I

  • 0

I have a php page which includes jQuery and a script.js file. When I put the following function inside my php file, the function gets executed and works as intended:

<script>
    $('#scoreboard-overview').load('getusers.php?q=<?php echo $NewString; ?>').fadeIn("slow"); 
</script>

What does it do? Wel it reloads the div with id scoreboard-overview in my php file with data from an external php file called getusers.php

This all works great.

Now in the script.js file (which is loaded at the end of the php page, right before </body>), I also want to reload this div when the updatescore.php file is done updating the database via a form. I have this code for it:

$.ajax({
    type: "POST",
    data: $("#form").serialize(),
    cache: false,
    url: "updatescore.php",
    success: function() { //reload overview
        $('#scoreboard-overview').load('getusers.php?q=' + document.getElementById('str') + '').fadeIn("slow");
    }
});​

So after success it should execute the jQuery function:

function () { //reload overview
    $('#scoreboard-overview').load('getusers.php?q='+document.getElementById('str')+'').fadeIn("slow");                  
}

I verified the code. The database gets updated using updatescore.php but after this (so after success), the div isn’t refreshed. So this success part of code isn’t working. What am I doing wrong?

ps: '+document.getElementById('str')+' should give me the same result as echo $NewString; only taken from the div with id str (since php doesn’t work inside a js file?)

  • 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-05T11:43:43+00:00Added an answer on June 5, 2026 at 11:43 am

    document.getElementById('str') is going to return the HTML element with the ‘str’ id, not the text within the element. I’m not sure what this element actually looks like, but you might do something like document.getElementById('str').textContent.

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

Sidebar

Related Questions

I have the following in a .htaccess file redirect 301 /page.php http://domain.com/page Which works
I have A function in jquery which goes to a php file, which querys
I have a web page which uses in PHP and a jQuery DataTable to
I have an iframe tab which holds php page with various links inside (like
I have a jQuery dialog which loads an external php page. All is working
I have a page (main.php) which loads content from an external PHP file (rpc.php).
So I have a regular PHP page which includes the header, body, and the
I have a PHP form which includes a file being uploaded upon submit. As
I have a file called function.js which has all my jQuery for my aplication
I have a json_encode in my php script which seems to fail the Jquery

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.