LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-07-2014, 03:20 PM   #1
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 20.04
Posts: 441

Rep: Reputation: 12
In Javascript How to replace elements in one object with elements from another object


Hi,

This has been driving be nuts!!! I'm trying to replace the names in MySqlRecord with the values in cols.

ie: In MySqlRecord "VendorId": "398" would become "Vendor Id No": "398"
Code:
var cols= {
	"IDno":"Id No",
   "VendorId": "Vendor Id No:",
   "AccountNo": "Account No:"
	}       
   
var MySqlRecord = {
    	  "IDno": "111",
        "VendorId": "398",
        "AccountNo": "2398-A"
	}
Any help in doing this will be appreciated.

R
 
Old 05-08-2014, 02:28 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
You have to use a third variable (tmp), loop thru the properties of "cols", assign
tmp[cols.property] = MySqlRecord.property;
then
MySqlRecord = tmp;
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] FontForge: how to join glyph elements into an object? w1k0 Linux - Software 3 01-23-2011 02:32 PM
[SOLVED] Access HTML elements via Javascript with internal ID action_owl Programming 4 04-02-2010 09:39 AM
javascript - having a problem recusively visiting elements... BrianK Programming 3 10-22-2007 01:22 PM
accessing forms elements with javascript djgerbavore Programming 2 06-03-2005 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration