[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Update Dabase using jquery

Posted on 2011-10-31
3
Medium Priority
?
179 Views
Last Modified: 2012-05-12
I have a report of all user. Each user have status Active,inactive other.

Upon clicking on each of the radio buttons I need to update the database.

I don't seems to getting this to work.

Please advice.

0
Comment
Question by:erikTsomik
3 Comments
 
LVL 11

Expert Comment

by:maeltar
ID: 37058370
jQuery ajax is the way to go ...

http://api.jquery.com/jQuery.ajax/
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 37058389
That is fine except Jquery ca not differentiate which radio button was clicked
0
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 37060390
$(":radio[name='your_group_button_name']").click(function() {

      // choose one :

      //button = $(this).index(":radio[name='your_group_button_name']"); // method 1, we use the index of the button in the list
      //button = $(this).val(); // method 2, we use the value of the button
      //button = $(this).attr("id"); // method 3, we use the id of the button
      //button = $(this).next("label").html(); // method 4, we use the html of the label
      //button = $(this).previous("span").html(); // method 5, we use the html of the label
      button = $(this).attr("id").replace("blablabla",""); // method 6, we use the id of the button and we replace the prefix
      // and so on...

      $.post("/path/to/update.ext", { "button": button} )
});

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question