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

The Archive Base Latest Questions

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

I am not getting response while fetching result from my code using AJAX. while

  • 0

I am not getting response while fetching result from my code using AJAX. while sending parameters to file my code is working good… that is, sending parameters to file , as I have checked using alert msg..
but my php file is not showing any response.

AJAX CODE.

function viewsg(){

document.getElementById('sgwaitingmsg').innerHTML = "Just a second...";
var childid = encodeURIComponent(document.getElementById('childsgselect').value);
var parameters ='childid=' + childid;
http.open('POST', 'fetchsg.php', true);
http.send(parameters);
//alert(parameters);
http.onreadystatechange = function(){
      if (xmlhttp.readyState==4 && xmlhttp.status==200 )
    {
    document.getElementById("sgwaitingmsg").innerHTML=xmlhttp.responseText;
        }
    }
}

PHP CODE.

<?php
//$_REQUEST["childid"];
//$_REQUEST["nocache"];
echo $_REQUEST["childid"];
?>

HTML CODE.

<label id="sgwaitingmsg"></label>
<select id="childsgselect" onchange="viewsg()" >
<option value="">Select Child</option>
<?php while($result=mysql_fetch_assoc($child)){print '<option value="'.$result["snum"].'">'.$result["sfname"].'</option>'; }?>
</select>
  • 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-25T02:23:22+00:00Added an answer on May 25, 2026 at 2:23 am

    $_REQUEST["childid"]; does not do anything. try

    echo $_POST["childid"]; 
    

    instead

    and you have syntax error in your code

    if (xmlhttp.readyState==4 && )
    

    should be

    if (xmlhttp.readyState==4)
    

    Try this one http://sandbox.phpcode.eu/g/904ed/10

    <?php 
    if (isset($_POST['childid'])){ 
        echo $_POST['childid']; 
        die(); 
    }  
    ?> 
    <div id="sgwaitingmsg"></div> 
    <input id="childsgselect" value="hellllo" /> 
    <script> 
    function viewsg(){ 
    
    document.getElementById('sgwaitingmsg').innerHTML = "Just a second..."; 
    var childid = encodeURIComponent(document.getElementById('childsgselect').value); 
    var parameters ='childid=' + childid; 
    var params ='childid=' + childid; 
    http=new XMLHttpRequest(); 
    http.open('POST', '<?php echo $_SERVER['PHP_SELF']; ?>', true); 
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
    http.setRequestHeader("Content-length", params.length); 
    http.setRequestHeader("Connection", "close"); 
    http.send(parameters); 
    //alert(parameters); 
    http.onreadystatechange = function(){ 
          if (http.readyState==4) 
        { 
        document.getElementById("sgwaitingmsg").innerHTML=http.responseText; 
            } 
        } 
    } 
    viewsg(); 
    </script>
    

    is fully working script. You’ll have to go through

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

Sidebar

Related Questions

Hi i am using following code. NSString *quant = [NSString stringWithFormat:@%@,item.capacity]; NSString *metricUnit =
There I am trying to load XML content from a remote host using Node.js.
I'm getting the dreaded Microsoft JScript runtime error: 'Sys' is undefined error while trying
While trying to explain to someone why a C++ static array could not by
The following code gives me a nodeList to itterate over: XPathNavigator thisNavigator = thisXmlDoc.CreateNavigator();
I am trying to validate weather the connection was successful but have been getting
I'm trying to return an XML file based on my query results. I'm very
The jquery function that I'm using is: $.getJSON(rpc2.php?queryString= +inputString+, function(data) { if(data.length >0) {
Looks like the question got deleted when I was pasting code. I have included
I have the following Xml in my Resources.xmltest: <?xml version=1.0 encoding=utf-8 ?> <Response xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance

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.