0

I have a view which has one textbox and one submit button. I want untill the user completes the textbox and presses the submit button to execute some queries somehow async.

How can i achive this? with AsyncController?

Thanks!

Alex
  • 87
  • 1
  • 3
  • 8
  • 1
    Do you mean that the user fills in the textbox and then you execute the queries? And then what? Your question is too vague. – Erik Funkenbusch Apr 10 '12 at 15:33
  • I guess it depends on what you need to be able to do. At its simplest, you can just have the button fire a jQuery AJAX call instead of submitting the form. That AJAX call can hit any standard controller action and then you can do whatever you want with the response. (Though I personally like to separate my JavaScript-specific controller actions and return content from the `JavaScriptSerializer` instead of a `View`.) – David Apr 10 '12 at 15:36
  • I want to execute the queries untill the user fills the textbox, and doesn't matter what he enters in textbox...the result of queries will be used later when the user click the submit btn – Alex Apr 10 '12 at 15:42

1 Answers1

1

No, you do not need an async contoller for this, a normal controller should do. What you will need to do is make an AJAX request from the page to the normal controller.

Async controllers are really for advanced thread management on the server, not on the client / web browser. An async controller allows server threads to be freed up during long-running tasks, such as network or disk intensive activity.

danludwig
  • 46,965
  • 25
  • 159
  • 237