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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:04:02+00:00 2026-05-14T00:04:02+00:00

I have this php code $jsonArray = array(); $sql = SELECT ID,CLIENT FROM PLD_SERVERS;

  • 0

I have this php code

$jsonArray = array();
$sql = "SELECT ID,CLIENT FROM PLD_SERVERS";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
    $jsonArray[] = array('id'=>$row['ID'],'client'=>$row['CLIENT']);
}
echo json_encode($jsonArray);

And this js

function autosearchLoadServers()
{

  $.post("php/autosearch-load-servers.php",function(data){
      var toAppend = "";
      for(var i = 0; i < data.length; i++){
          toAppend += '<option value = \"' + data[i].id + '\">' + data[i].client + '</option>';
      }
      $("#serverSelect").empty();
      $("#serverSelect").html(toAppend);
  });

}

The problem is that i get only undefined values. How can this be? The values are in the JSON, i checked using firebug in mozilla so there has to be something with the data variable but i can’t understand what. I tried different ways and no results.

  • 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-14T00:04:02+00:00Added an answer on May 14, 2026 at 12:04 am

    Try specifying the datatype in the post call like this:

     $.post("php/autosearch-load-servers.php",function(data){
      var toAppend = "";
      for(var i = 0; i < data.length; i++){
          toAppend += '<option value = \"' + data[i].id + '\">' + data[i].client + '</option>';
      }
      $("#serverSelect").empty();
      $("#serverSelect").html(toAppend);
    }, "json");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this PHP code: $result = mysql_query(SELECT distinct om_quote_no from `porders` order by
I have this PHP code : $query = SELECT * FROM news WHERE news_active
I have this PHP code: $query = SELECT name, COUNT(message) FROM guestbook_message WHERE name='.$req_user_info['username'].'
I have this php code line $data['viewData']['filter'] = isset($parameters['filter']) ? $parameters['filter'] : array('filter1', 'filter2',
I have this PHP code - <?php for($i=1; $i<=1000; $i++) { $array=array(); $array[$i]=54*$i; $arr=array($array[$i].,);
Ok so i have a php script: <?php mysql_connect(localhost,root,root); mysql_select_db(FYP); $sql=mysql_query(select team_name, games_played, games_won,
I have this php code from a wordpress theme <?php .... $image_source = bloginfo('template_url').'/timthumb.php?src='.$slider_images[$i].'&w=940&h=400&zc=1';
I have this php code that grabs binary( blob ) data from the database
I have this PHP code to copy files from one directory to another and
I have this php code: if ($merchant_rows > 0){ while($r=mysql_fetch_array($get_merchant)){ $merchant_id = $r['merchant_id']; }

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.