Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to get string's value ?

Posted on 2009-04-04
2
Medium Priority
?
484 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 2000 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

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
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).

688 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