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

  • Home
  • SEARCH
  • 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 3425336
In Process

The Archive Base Latest Questions

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

I have a form that is going to be executing a failry long running

  • 0

I have a form that is going to be executing a failry long running process. Not just long, but many small steps during an install process. I’m trying to stay away from using the built in MS AJAX as much as possible in my entire application, but will use it on this page if it’s just the easier way to do things.

But what I want is to only one jQuery AJAX call to code behind and have code behind spit out progess as it hits each step. Here is what I’ve gotten so far. It’s just sample code but it’s what I’m trying to do.

UI:

<head runat="server">
    <title></title>
    <script type="text/javascript">
        $(function() {
            $(this).find("#submitForm").click(function() {
                RunCodeBehind();
            });
        });

        function RunCodeBehind() {
            $.ajax({
                error: function(msg) { alert(msg) }, 
                type: "POST",
                url: 'Other.aspx/RunLongRunningProcess',
                data: "{}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(responses) {
                    if (responses.d != "") {
                        //Display process in UI
                        var divEvents = document.getElementById("events");
                        divEvents.innerText = divEvents.innerText + "\n" + data;
                    }
                    else {
                        //no response, update as failed
                        var divEvents = document.getElementById("events");
                        divEvents.innerText = divEvents.innerText + "No response from code behind";
                    }
                }
            });
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <a id="submitForm">Start Process</a>
        <br />
        <div id="events"></div>
    </div>
    </form>
</body>

Code behind:

[WebMethod]
public static string RunLongRunningProcess()
{
    string returnValue;
    var sqlQuery = "SELECT COUNT(*) FROM Users;"; //generic sql query
    returnValue = ExecuteQuery(sqlQuery);

    //feedback cout total to UI, continue process

    var sqlQueryInsert = @"INSERT INTO Log (UserCount) 
                            SELECT COUNT(*) FROM Users;"; //generic sql insert
    returnValue = ExecuteNonQuery(sqlQueryInsert);
//feedback insert step to UI
    var sqlQuery = "SELECT user + ' - ' + name + ' - ' + favday FROM Users;"; //generic sql query
    returnValue = ExecuteQuery(sqlQuery);
    //feedback selection to UI

    return returnValue;
}

Any pointers on how to make it feed back to the UI more than once with just a single call?

  • 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-18T06:34:54+00:00Added an answer on May 18, 2026 at 6:34 am

    I would be inclined to try the other way around, and poll another web service method from your JQuery code instead.

    In your ‘RunLongRunningProcess’ method, I would simply update a session integer variable with values from 0 to 100.

    Then I would create a separate web service method that returns the current value of this variable.

    You can then poll this new method every (for example) second to get the current upload status.

    I believe PeriodicalUpdater for JQuery will allow you to achieve this:

    http://www.360innovate.co.uk/blog/2009/03/periodicalupdater-for-jquery/

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

Sidebar

Related Questions

I'm writing a simple app that's going to have a tiny form sitting in
I have a form that is going to be used to search through a
I have form that displays several keywords (standard set of choice lists that changes
I have a form that contains a GridView control which is databound to an
I have a form that I would like to style. specifcally I would like
I have a form that searches all rows in a single table (TServices) that
I have a form that is sending in sizes of things, and I need
I have a form that has multiple fields, and for testing purposes is there
I have a form that uses jQuery to submit an ajax post and it
I have a form that excepts a file upload in ASP.NET. I need 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.