aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Passing JS Array to java using jquery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Passing JS Array to java using jquery" Watch "Passing JS Array to java using jquery" New topic
Author

Passing JS Array to java using jquery

Naveen puttu
Ranch Hand

Joined: Sep 15, 2009
Posts: 88
Hi,

Here is my js function



while i look in the firebug, the contents of the array looks like this



but when the access the array in my action class i see this


What am i missing and where am i wrong ??


Cheers
n4v33n
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

Have you inspected how the data is being passed in HTTP? Whenever you have this type of issue, the first thing to check is whether the data is being passed in the HTTP request as you expect.

Firebug is a good tool for this.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Just a note of adding things to an array

Instead of doing



you should use push



no need to use a counter!

Eric
Naveen puttu
Ranch Hand

Joined: Sep 15, 2009
Posts: 88
tried push as well but it doesnt seem to work

what i guess from this is that , data: {array:sectionWeightsArrayObject} in mt js function probably doesnt accept object and we need to stringify that

am i right ??

if yes how would i achieve that
Naveen puttu
Ranch Hand

Joined: Sep 15, 2009
Posts: 88
yo yo yo eric

i fixed this issue

i just had to do this

Cheers
n4v33n
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing JS Array to java using jquery