In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is to share with you the content of the sample analysis of the server-side invocation of the ajax implementation in jQuery. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The details are as follows:
I studied and discussed with teacher shotdog the ajax solution in asp.net, in addition to the official huge asp.net ajax. Our idea is to output in different server-side ways, and then use the ajax implementation of jQuery to invoke several server-side solutions on the page:
1. Use general webform, call it with jQuery ajax on the page, then get the contents from the obtained html data and write them to DOM.
Advantages: without changing the existing asp.net development mode, you can use ready-made pages; the content obtained by ajax is html text, which can be directly written into DOM.
Disadvantages: content is wasteful, anything other than content is not necessary, and if MasterPage is used, then.
2. Use normal webform, but use Response.Write () to control the output html, and use jQuery ajax to call on the page to write the acquired content to DOM.
Advantages: the content is clean and not wasted; the content obtained by ajax is html text, which can be written directly into DOM
Disadvantages: html text needs to be constructed in the form of a string on the server side, which is not convenient for programming and not easy to debug and maintain.
3. Use general webform, use Response.Write () to control the output of json data, call it with jQuery ajax on the page, and write json data to DOM after being processed into html on the client side.
Advantages: only exchange json data, extremely clean, in line with efficient web design concept
Disadvantages: need to process json data on the client side and cause intrusion to DOM
4. Use asmx, encapsulate it into web service, call the contents of asmx with jQuery ajax, and write json or xml data to DOM after being processed into html on the client side.
Pros: only exchange json or / xml data, very clean; web service is easy to cross-platform
Disadvantages: need to process json data on the client side and cause intrusion to DOM
5. Use the custom control ascx, and then use a special webform page to do wrapper (wrapper) call wrapper webform with jQuery ajax on the page, and write the html data to DOM
Advantages: webform is only used as wrapper, custom controls can be used dynamically in wrapper according to different request parameters; custom controls output html text, which can be directly written into DOM; programming convenience, VS2008 code-aware support, easy to debug and maintain
Disadvantages: unlike traditional webform programming concepts, it weakens the role of webform
These are the several possible options discussed-- whether asp.net webform or asp.net MVC-- are feasible.
Another solution was found last night: using ashx+jQuery .ashx is a special file type for processing HttpHandler to handle custom Http requests, and you can define how Http requests are handled against ashx at run time in web.config.
So we can use SimpleHandlerFactory to process ashx's http request. By implementing the IRequiresSessionState interface in the class of ashx, System.Web.SessionState under using can use Session, which is very convenient.
Using System.Web.SessionState;public class checkCookie: IHttpHandler, IRequiresSessionState {... / / todo somthing}
Example: using ashx+jQuery to verify the existence of Email
.ashx file
Using System;using System.Web;public class CheckUser: IHttpHandler {public void ProcessRequest (HttpContext context) {context.Response.ContentType = "text/plain"; context.Response.Write (UserRule.GetInstance () .IsUserExist (context.Request ["Email"]));} public bool IsReusable {get {return false;}}
Html:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.