Ajax in the asp.net application of the basic
In fact, the basic use all understand that they did not think that cite an example.
<script Ype="text/javascript">
Var xmlHttp;
/ / Create an object XmlHttpRequeset 
Function createXMLHttpRequest ()…{ 
If (window.ActiveXObject )…{
XmlHttp = new ActiveXObject ( "Microsoft.XMLHTTP");
) 
Else if (window.XMLHttpRequest )…{
XmlHttp = new XMLHttpRequest ();
)
)
/ / Beginning of a request 
Function startRequest ()…{
CreateXMLHttpRequest ();
XmlHttp.onreadystatechange = handlestatechange;
XmlHttp.open ( "GET", "innerHtml.xml", true);
XmlHttp.Send (null);
) 
Function handlestatechange ()…{ 
If (xmlHttp.readyState == 4 )…{// describes a "loaded" state at this time, response has been completely received. 
If (xmlHttp.status == 200 )…{// 200 that received successful
Document.getElementById ( "results"). InnerHTML = xmlHttp.ResponseText;
)
)
)
</ Script> 
Aaa.aspx the innerHtml.xml replaced, and then in the html aaa.aspx all empty. Aaa.aspx.cs only in the Page_Load function inside to write on the data, then we can. As follows
Protected void Page_Load (object sender, EventArgs e) 
(…
Response.Clear ();
Response.ClearContent ();
Response.ClearHeaders (); 
Request.QueryString string custID = [ "CustID"]. ToString (). Trim (); 
/ / String custID = "11532"; 
GetAssetIDsByCustID string assetIDs = (custID);
Response.Write (assetIDs); 
Response.End ();
)
AssetIDs here can be made string, xml, json. Recommended json here, the transmission is good because it is said. Net json now also provide good support.
Tags: Basic
Releated Posts
Categories
- CSS Properties (491)
- CSS Tutorial (1154)
- CSS Tutorial By Examples (1201)
- Css+Div Web Design (3274)
- Xhtml and Web Design (1797)
Archives
Pages






Leave a Reply