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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:28:16+00:00 2026-05-18T01:28:16+00:00

my php code $classObject = new class_functions(); $city = $_REQUEST[‘city’]; $locations[] = $classObject->populate_locations($city); echo

  • 0

my php code

$classObject = new class_functions();
$city = $_REQUEST['city'];
$locations[] = $classObject->populate_locations($city);
echo "var result=".json_encode($locations);

my jquery

$("select[name='city']").change(function(){
    var city = $("select[name='city']").serialize();
    $.ajax( 
    { 
       type: "POST", 
       url: "jquerycalls.php", 
       data: city,
       beforeSend: function() {
       //alert("asdf");
       },
       success: function(data1) {
       // multidimensional array over here
       }

    });  
});

The result i get from an alert in the success: part of jquery

var result=[[["Aabpara Market"],["AGHOSH"],["Akbar Town"],["Alipur Farash"],["Atomic Energy Employee Society"],["AWT"],["B-17"],["Bahria Town"],["Bani Gala"],["Bharakhu"],["Blue Area"],["British Homes Colony"],["Burma Town"],["CBR Town"],["Chak Shahzad"],["Chaklala Scheme 3"],["Civic Centre"],["D-12"],["D-13"],["D-16"],["D-17"],["D-18"],["Darussalam Co-Op Society"],["Defence Phase-2"],["Defence Phase-I"],["DHA Valley"],["Diplomatic Enclave"],["E-6"],["E-7"],["E-11"],["E-12"],["E-14"],["E-16"],["E-17"],["E-18"],["Engineers Cooperative Housing Society"],["F-10"],["F-11"],["F-13"],["F-15"],["F-16"],["F-17"],["F-5"],["F-6"],["F-7"],["F-8"],["Fateh Jang"],["G-5"],["G-6"],["G-7"],["G-8"],["G-9"],["G-10"],["G-11"],["G-13"],["G-14"],["G-15"],["G-16"],["G-17"],["Ghauri Town"],["Gulzar Housing Scheme"],["H-13"],["H-15"],["H-8"],["H-9"],["Humak"],["I-8"],["I-9"],["I-10"],["I-11"],["I-12"],["I-14"],["I-15"],["I-16"],["I-17"],["Islamabad Airport"],["Islamabad Cooperative Housing Society"],["J and K Zone-V"],["Jinnah Garden"],["Jinnah Super Market"],["Jinnah Town"],["Judicial Town"],["Kahuta"],["Korang Town"],["Margalla Town"],["Melody Market"],["Motorway City"],["Muree Expressway"],["National Police Foundation"],["Naval Anchorage"],["New Shakrial"],["O-9"],["Orchard Scheme"],["P.W.D Housing Scheme"],["PAF Tarnol"],["Pakistan Housing Society"],["Pakistan Town"],["PECHS"],["Rawal Town"],["River Garden"],["Roshan Pakistan Scheme"],["Sangjani"],["Sawan Garden"],["Shehzad Town"],["Sihala"],["Sohan Valley"],["Super Market"],["Tarlai"],["Top City 1"],["University Town"],["Wapda Town"],["Zero Point"],["Zone 5"]]]

How can i use the multidimensional array that is returned from the php code?

  • 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-18T01:28:16+00:00Added an answer on May 18, 2026 at 1:28 am

    Change the PHP to:

    echo json_encode($locations);
    

    And then in the JQuery you can do:

    success: function(data1) {
        var result = eval(data1);
        result[0][0];
    }
    

    You can access the other elements in the array the same way.

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

Sidebar

Related Questions

I wrote a PHP code like this $site=http://www.google.com; $content = file_get_content($site); echo $content; But
This PHP code... 207 if (getenv(HTTP_X_FORWARDED_FOR)) { 208 $ip = getenv('HTTP_X_FORWARD_FOR'); 209 $host =
The following PHP code snippet uses GD to resize a browser-uploaded PNG to 128x128.
I am running following PHP code to interact with a MS Access database. $odbc_con
I am using following PHP code to connect to MS Access database: $odb_conn =
Say i have this PHP code: $FooBar = a string; i then need a
I'm refactoring some PHP code and discovered that certain nested combinations of if ()
I am writing PHP code where I want to pass the session id myself
Optimization of PHP code via runtime benchmarking is straight forward. Keep track of $start
I have this php code, with which I am trying to generate a popup

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.