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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:41:24+00:00 2026-05-28T14:41:24+00:00

I have to have a result which looks like this: ({1: ‘string’, 2: ‘anotherstring’,

  • 0

I have to have a result which looks like this:

            ({1: 'string', 2: 'anotherstring', 3: 'andanother'});

It’s not limited to three, it could be a variety of lengths (although not above 10).

I’m grabbing data from a php file through a loop:

            success: function(data, status){
                $.each(data, function(i,item){
                    var variableName = '<h1>'+item.draw+'</h1>'
                    + '<p>'+item.date+'</p>';

                    output.append(variableName);
            });

Basically I would like to have the ‘draw’ and ‘date’ variables (eg a string “3123 2010-12-01”) put into an array with ‘key identifiers’ as it’s needed by the script. I’m not sure the best way to go about this. I know it has to be inside the loop, and i’m thinking using the .append might have something to do with it?

            ({1: '3123 2010-12-01', 2: '6410 2011-04-28', 3: '7129 2012-01-01'});
  • 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-28T14:41:25+00:00Added an answer on May 28, 2026 at 2:41 pm

    In the example, map will be the final object you’re looking for. There’s probably a better way to write it though.

    // data looks like: [ {draw: '1', date: 'date1'}, {draw: '2', date: 'date2'} ];
    var map = {};
    $.each(data, function(i, v) {
        map[v.draw] = v.date;
    });
    // do what you need with map here
    

    Example: http://jsfiddle.net/tscr9/

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

Sidebar

Related Questions

I have a method for searching which looks like this: public IEnumerable<Result> Search(string searchText)
I have a string which looks like this: ABAR_VAL, ACQ_EXPTAX_Y, ACQ_EXP_TAX, ADJ_MATHRES2 And I'd
I have a query which returns a result set which looks like this: A
I have jQuery code which looks something like this on Button1 Click $('table.result_grid tbody
I have a model which looks like this: class MyModel(models.Model) value = models.DecimalField() date
Hi all I have a piece of code which looks like this: public class
Hey, I have a report parameter which looks like this: 01.01.2009 00:00:00 Its a
I have a Haskell file which looks like this: longest::[Integer]->[Integer]->[Integer] max a b =
I have a yaml file which looks like this: --- date: 25-01-2010 version: 0.1
Hi all I have a local file which looks like this: AAA Anaa AAC

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.