Solved

How to get string's value ?

Posted on 2009-04-04
2
483 Views
Last Modified: 2012-05-06
I have 2 strings called products_1 and products_2...

I have another string that holds the name products_1 and I'm trying to get into a 3rd string the products_1 value using the products_1 name...

example included
var products_1 = [
	{ id: "1", name: "food" },
	{ id: "2", name: "blah" },
];
 
var products_2 = [
	{ id: "3", name: "asd" },
	{ id: "4", name: "dsa" }
];
 
var catName = 'products_' + ltypeid;
$("#product_suggest").autocomplete(catName);

Open in new window

0
Comment
Question by:OrTzabary
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
cyberstalker earned 500 total points
ID: 24067036
This is very easy using an array.
var products_1  =   new Array()
 
products_1[1]   =   "food";
products_1[2]   =   "blah";
 
var catName = products_[ltypeid];
$("#product_suggest").autocomplete(catName);

Open in new window

0
 
LVL 3

Author Closing Comment

by:OrTzabary
ID: 31566555
Thanks..
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question