Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Submitting checkbox values via jQuery

 
Ranch Hand
Posts: 181
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created java script method to get the list of selected check boxes.
I can't get that array to the java class in REST?
Does any one have a answer?

this is java script code
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
       <script type="text/javascript">
           $(document).ready(function() {
               $("button").click(function(){
                   var tabs = new Array();
                   $.each($("input[name='window']:checked"), function(){            
                       tabs.push($(this).val());
                   });
                   document.write(tabs.join(" "));
               });
           });
       </script>

and these are the check boxes.

<label><input type="checkbox" value="permission" name="window"> Permission</label>
       <label><input type="checkbox" value="activity" name="window"> Activity</label>
       
 
Saloon Keeper
Posts: 7174
166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not? What happens if you use this code, and what did you expect to happen instead?
 
chamini prashakthi
Ranch Hand
Posts: 181
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to send this tabs array to the rest? How can I do it?
 
Tim Moores
Saloon Keeper
Posts: 7174
166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:What happens if you use this code


Please be precise. Does the code even run? Even if it does, I don't see how it helps with any server interaction.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic