Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-15-2012, 09:24 AM   PM User | #1
aurora26
New to the CF scene

 
Join Date: May 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
aurora26 is an unknown quantity at this point
how to pass a hash table from perl to javascript function?

hello all, plaese tell me how can i pass a hash table to the javascript from a perl function as an arguments?

i'm trying as below...in perl function hash table sent as an argument, in javascript it is receiving as below....but its not working,,,,
Code:
 HashRowUnit=argv[1];  
  
    alert('size of hash table ' +HashRowUnit.length); 
  
  
for (var k in HashRowUnit) {   
if (HashRowUnit.hasOwnProperty(k)) {  
alert('key is: ' + k + ', value is: ' + HashRowUnit[k]);} }
aurora26 is offline   Reply With Quote
Old 05-16-2012, 07:02 AM   PM User | #2
Dormilich
Senior Coder

 
Dormilich's Avatar
 
Join Date: Jan 2010
Location: Behind the Wall
Posts: 2,881
Thanks: 9
Thanked 291 Times in 287 Posts
Dormilich is on a distinguished road
I don’t know how a hash table in Perl looks like, but if JavaScript should be able to read it, it must be in a JS-compatible format (e.g. JSON)
__________________
please post your code wrapped in [CODE] [/CODE] tags
Dormilich is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:53 AM.


Advertisement
Log in to turn off these ads.