简体   繁体   中英

respond to an ajax call in c#

I have some javascript files and an html file. The do some stuff, and I'd like to make an ajax call (using jQuery's $.post() method) to a server to get some info, and then do some more stuff. Do I need to set up some sort of scaffolding before I can do this? I have a.cs file now, can I just run that with VC# and have it respond to the requests? I'm not sure where to begin. I've looked a little for tutorials... but the ones on microsoft.com are old; Thanks!

23890123890

Update : I believe this is ASP.NET MVC

If you're using webforms, you can look atPage Methods

I'm guessing you might be using MVC though, which you may want to refer to this question: PageMethods with ASP.Net MVC

Another option if you're not using MVC would be to use WCF to create a service which can receive the jQuery ajax requests. The project at http://wcf.codeplex.com/ has some support for jQuery $.ajax calls.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM