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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:14:51+00:00 2026-06-02T08:14:51+00:00

I need to parse JSON in jQuery autocomplete function. I used following code. jQuery(#name).autocomplete(

  • 0

I need to parse JSON in jQuery autocomplete function. I used following code.

jQuery("#name").autocomplete( '<?php echo HTTP_PATH.'/songs/sss'; ?>', {
multiple: true,
mustMatch: true,
matchContains: true,
autoFill: false,
dataType: "json",
});

My cake Controller regarding that is

public function sss(){
$condition = array('Poet.status'=>'3');
$poet_name = $this->Poet->find('list', array('conditions' => $condition));
//pr($poet_name); exit;
echo json_encode($poet_name);
$this->autoRender = false;
}

I am receiving my data as simple array. Means

Array(
[1]=>Abc,
[15]=>Xyz
[56]=>MNK
[77]=>skl
[85]=>qw5s
)

How can I parse read and format following returned array with jquery.

  • 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-06-02T08:14:53+00:00Added an answer on June 2, 2026 at 8:14 am

    JQuery Autocomplete requires label and/or value, where the label is displayed. Unless there is a need to parse json on the client side, I would do it on the server-side (simpler to me).

    Being that you could insert the following:

    $json_output = array();
    
    foreach ($poet_name as $name) {
         $json_output[]['label'] = $name;
    }
    
    echo json_encode($json_output);
    

    By formatting on the server-side, the json is preformatted for the json autocomplete making the markup on smaller resulting in a quicker upload of the page and less clutter.

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

Sidebar

Related Questions

Possible Duplicate: Parse JSON with jQuery I tried to parse the following JSON File.
I am using PHP, jQuery, and JSON. Now I need to know how to
Possible Duplicate: how to parse json in javascript I need to parse this JSON
i need to parse the JSON data given below. {result:[{bookId:142645,bookpb:MF, bookTs:1328999630000,clipStatus:D,bookDetail:{arrival:1,purchase:1,sold:1}, hierarchies:{categories:[4],events:[]},shopId:769752}, upto sold
I need to parse this json and get the itemvotecounts, and firstrankvotescounts. [ [
i need to parse the json array contacts from the below json { },
In my application, I need to parse a JSON that includes the end time
Hi I need parse and deserialize pseudo JSON string. Input data: {aBubbleData[ 'jaja2581' ]={
I have the following function which uses the old Bassistance autocomplete: $('#searchLocation').autocomplete(/Utils.aspx, { dataType:
here's my jQuery to parse Json result I got back from one of my

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.