Solved

How to get string's value ?

Posted on 2009-04-04
2
480 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will learn how to dynamically set the form action using jQuery.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

789 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