Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9155033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:31:29+00:00 2026-06-17T12:31:29+00:00

Currently I am calling a function in code behind once someone clicks on a

  • 0

Currently I am calling a function in code behind once someone clicks on a button (using button’s event) and using following ajax :

$('.toggleBtn').click(function(e) {
    $.ajax({
                        type: "POST",
                        url: "page.aspx/function",
                        data: "{'id': '" + id + "'}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        async: false,

                        success: function (msg) {

Is it possible in jquery to hook to all of the controls events in current page and run only one $.ajax.

Say I have four controls, two textboxes and two comboboxes and want to update database accordingly. if i want to run the above I need to hook to their click events one by one and run separate function in code behind, which will not be ideal.

In another words want to populate my object once the user selects/inputs the control value.

Hope it makes sense.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:31:29+00:00Added an answer on June 17, 2026 at 12:31 pm

    If I understand your question, you’re asking how to fire the same code for the click event of a group of elements, but wish to pass the ID of the clicked element as a parameter in the data. If so, this will do it for all elements with the class className…

    $('.className').click(function(e) {
        $.ajax({
            type: "POST",
            url: "page.aspx/function",
            data: "{'id': '" + this.id + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            async: false,
            success: function (msg) {
                ...
                ...
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

html img returned from ajax has class of 'tocrop'. Currently I Calling the function
Currently I am calling a title from the database using the below code it
currently I have the following code inside my 'function.php' is function calcTime($database_name,$currentTime){ global $startTime;
I am currently developing on Objective-C using sqlite3. The following code seems like a
I'm currently using this method in calling batch files in vb.net: Private Sub Button3_Click(ByVal
I'm currently using the below function to print my debug strings: void Script::OutputDebugStringN(const char
I have a parser function written in my code-behind file, that takes as input
Using gcc 4.4.3 c89: I am just working on the following code below: I
I'm using the following function to get a JSON Array from a php webpage.
We are currently calling web services on our application server through our web server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.