Reputation: 1589
I have an ajax that is successfully passing things into my controller
var ids = grid.jqGrid('getGridParam','selarrrow');
if (ids.length>0) {
var names = [];
for (var i=0, il=ids.length; i < il; i++) {
var name = grid.jqGrid('getCell', ids[i], 'uniqueIdentifyingName');
names.push(name);
}
}
Then I created an alert that spits this out so I know they are in there:
"alex's names: other test,test"
Now I would like to pass as data.
I am currently passing them using ajax using
data: {'names':JSON.stringify(names)},
dataType: 'json'
But I can't parse it in the grails controller
I am currently doing this:
List<JSON> Mynames = JSON.parse(params.names)
Mynames.each{println "MY name is: $Mynames"}
Which is outputting:
MY name is: [other test, test]
MY name is: [other test, test]
How can I parse this?
Upvotes: 0
Views: 520
Reputation: 66663
Instead of printing the whole Mynames
object in each iteration, print out the current item using it
Mynames.each{ println "MY name is: $it" }
Upvotes: 1