Ajax calls only with ASPX files background CS no flush program. Instance
Two files: aaa.aspx and Aaa.aspx.cs
First, aaa.aspx
<script type= "Text/javascript" > function Request () { alert ("1"); $.ajax ({ type: ' Post ', URL: ' test442.aspx?method=send2 ', //' Invoke background event ' Cache:false, success: function (data) { if (data = = ' 00000 ') { //receive (); } var tbreceive = $ (' #tbReceive '). Val (); $ (' #tbReceive '). val (tbreceive + data + ";"); }, error:function (XMLHttpRequest, textstatus) { } } ); }; </script>
Second, Aaa.aspx.cs
protected void Page_Load (object sender, EventArgs e) {string result = ""; if (! IsPostBack) {if (request["method"]! = null) {try { Switch (request.querystring["method"]) {case "Send2"): result = Send2 (); <span style= "font-family:arial, Helvetica, Sans-serif;" >//"event Send2 performed" </span> break; }} catch (Exception ex) {result = ex. Message; Logmanager.writelog (ex. Message); } response.clear (); Response.ContentType = "Text/plain"; response.contentencoding = System.Text.Encoding.UTF8; Response.Write (Result); Response.End (); } } }
Use only ASPX files to implement Ajax calls to the background CS program. Instance