LinuxQuestions.org
Help answer threads with 0 replies.
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, 04:20 PM   #1
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 18.04
Posts: 344

Rep: Reputation: 9
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, 03: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:32 PM
[SOLVED] Access HTML elements via Javascript with internal ID action_owl Programming 4 04-02-2010 10:39 AM
javascript - having a problem recusively visiting elements... BrianK Programming 3 10-22-2007 02:22 PM
accessing forms elements with javascript djgerbavore Programming 2 06-03-2005 03:32 PM

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

All times are GMT -5. The time now is 01:02 PM.

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