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

I am getting an error while exporting data to an excel sheet. Code Response.Clear()
hi im trying to using flashVars however for some reason there not getting sent
So my code is below. I'm not getting any errors and it places everything
I am working on a project to call a webservice from different domain using
I am getting an error in my code while i try to show the
Have problem while getting data from Memcached on .NET MVC solution. I have this
I posting my value through ajax and using the response the details will be
Hi Below is the code i m using for login page.but it does not
I am doing soap request/response application. While building soap response, I am getting Server
I am sending post request from android to the url using httpclient like this

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.