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 3607350
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:21:54+00:00 2026-05-18T21:21:54+00:00

I have a loop in JS, and I want to pass each parameter in

  • 0

I have a loop in JS, and I want to pass each parameter in that loop to a function in ASP.NET in the codebehind.

something like that:

for (var i = 0; i < elements.length; i++)
    {                    

    }

And I want to pass a function in <%%> the elements[i].

How can I do that?

thanks!

  • 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-05-18T21:21:54+00:00Added an answer on May 18, 2026 at 9:21 pm

    It’s not that easy, the only way is to make a post and send the variables.

    What I normally do is to have a handler to do the job for me and using jQuery I get a nice pretty effect…

    from your javascript code

    var r = '';
    for (var i = 0; i < elements.length; i++)
        r += elements[i] + ',';
    
    // send this asynchronously to the handler
    $.get("myHandler.asmx", { values: r }, function(data) {
      // it finished processing, let use the passed data
      alert(data);
    });
    

    in your handler

    public void ProcessRequest(HttpContext context)
    {
        string r = context.Request["values"];
    
        // process them
    
        context.Response.ContentType = "text/plain";
        context.Response.Write("OK");
    }
    

    that “OK” will be passed to the data variable, and you can interact your user with a much more rich environment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that's generated by a normal PHP loop. What I want
I have a loop that reads each line in a file using getline() :
I have a for loop that I pass through ssh to a server that
I want my app to loop in python but have a way to quit.
I have a loop on page to update an access database that takes 15-20
In my WPF client, I have a loop that calls a WCF service to
If you have a for loop such as: For Each s As String In
I'm trying to solve the 3n+1 problem and I have a for loop that
I have a SQLClient.DataSet in VB.NET, and I want to insert the entire thing
I have this XML file that I have imported into Cocoa and want to

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.