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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:25:23+00:00 2026-05-21T03:25:23+00:00

index.php <?php //grab product id’s who need to be showed $pids = ‘1,2,3’; ?>

  • 0

index.php

<?php
    //grab product id's who need to be showed
    $pids = '1,2,3';
?>

<html>

<head>
    <?php include 'lol.js.php'; ?>
</head>


<body onload="update_timers();">


    <div id="timer_3183" class="timer countdown clearfix" title="1301994024"></div>

lol.js.php

<script type="text/javascript">

function update_timers()
{
    check_detail('<?=$pids?>', 'ajax.php');
}




function updatepage(str, pids)
{
      //loop through all the products, change time
      document.getElementById("timer_3183").innerHTML = document.frm.hide.value;
}

function check_detail(pids, strURL) 
{
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() 
    {
        if (self.xmlHttpReq.readyState == 4)
            updatepage(self.xmlHttpReq.responseText, pids);
            //document.getElementById("myDiv").innerHTML = self.xmlHttpReq.responseText;
    }
    self.xmlHttpReq.send("pids=" + pids); //this goes to PHP script via POST
}


</script>

ajax.php

<?php

    echo '
<form name="frm">
    <input type="hidden" name="hide" value="Some random text">
</form>';
?>

I’m trying to get the div in index page set to the value in ajax.php.

The line that’s not working is:
document.getElementById(“timer_3183”).innerHTML = document.frm.hide.value;

If i replace it with a literal string, it works:
document.getElementById(“timer_3183”).innerHTML = “rand text”;

But when i want to set it to “document.frm.hide.value;” expression, the value doesn’t change when the page loads.

Any ideas what I’m doing wrong?

  • 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-21T03:25:24+00:00Added an answer on May 21, 2026 at 3:25 am

    Well, I don’t know what that “loop through …” comment means, but:

      document.getElementById("timer_3183").innerHTML = str;
    

    seems like it’d do something more interesting. The form you want to add is in the XMLHttpRequest response text, right? That’s what your “ajax.php” file returns to the browser. At the point that the request succeeds, it’s still just plain un-parsed text. By stuffing that text into the “innerHTML” property of the target “drop zone” <div>, you give it to the browser for parsing. When that’s done, the form will be there inside that <div>.

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

Sidebar

Related Questions

index.php <html> <head> <script language=JavaScript src=lol.js.php></script> </head> <?php //grab product id's who need to
index.php <?php session_start(); header(Location: somewhere.php); ?> <html> <head></head> <body> <?php $_SESSION['foo'] = 'bar'; ?>
index.php: <html> <head> <script type=text/javascript src=script.js></script> </head> <body> <div id=box></div> <div onclick=getContent()>Open Window</div> </body>
Let's say I just want to use PHP include to grab HTML from another
Ok, so I have a string like so: index.php?page=test2;sa=blah And I need only to
alert($(this).children().next().html()); returns <a href=thelink.php?id=XXXX>click me...</a> How do I change above statement to grab only
index.php: <form action=update_db.php method=post> <?php require_once 'modules/' . $currentModule . '.php'; ?> </form> modules/
index.php <?php require_once('fr.php'); header('Location:'.abspath().directory()); ?> fr.php <?php require_once('functions.php'); ?> functions.php function abspath() { return
I have a index.php page that is the main page. All pages are included
I have an index.php for registration, a login.php as the registration handler. when the

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.