Let's take a look at HTML.Code:
< Html >
< Head >
< Title > Demo for how to call C # business from HTML page </ Title >
< Script SRC = "Http://www.zivosft.com/core/lib.js" > </ Script >
</ Head >
< Body >
< Form ID = "Default" Action = "Zivsoft. Business. demoshow. addsample" >
< Input ID = "" Type = "Text" > +
< Input ID = "B" Type = "Text" > +
< Input ID = "C" Type = "Text" > =
< Input ID = "TXT" Type = 'Text' >
< Input Type = "Button" ID = "Add" Value = "Submit" Onclick = "Callbusiness ();" >
</ Form >
</ Body >
</ Html >
Let's take a look at the HTML interface:
The above is a very simple demo to demonstrate how to construct three input boxes through the HTML interface, and call the descendant C # logic zivsoft. Business. demoshow. addsample to implement the sum of three numbers.
Let's take a look at the background C # business logic:
Namespace Zivsoft. Business. demoshow
{
Public Class Addsample: basecontrol {
Private Void Add_click (icomponent Com)
{
This . Txt. Value = System. Convert. toint32 ( This . Ga-. value) + System. Convert. toint32 ( This . TBB. value) + System. Convert. toint32 ( This . TBC. value ); } }
}
Finally, let's look at a piece of JavaScript code:
VaR URL = Http://www.zivsoft.com/cloudserver/default.aspx ;
Req. Open ( " Post " , URL, async );
Req. setRequestHeader ( " Content-Type " , " Application/X-WWW-form-urlencoded; charset = UTF-8 " );
While (Reqdata. indexof ( ' / ' ) ! = - 1 ) { Reqdata = Reqdata. Replace ( ' / ' , ' % 2f ' ); }
Reqdata = Reqdata. Replace ( / \ < / G, " % 3d " );
Reqdata = Reqdata. Replace ( / \> / G, " % 3E " );
// Send the request data to the cloud aspxProgram
Req. Send (reqdata );
If ( ! Async) {
If (Req. Status = 200 ) {
Return Req. responsetext;
} Else {
Alert ( ' Cloud server error ' );
}
}
I don't need to write much. Do kids know what's going on?
Nowadays, the technology is changing with each passing day, and the terminal program layers are not consistent, such as XAML and HTML5. Although the UI is becoming more and more beautiful, there are more and more application terminals, such as Android and WP7, but what remains unchanged is the backend service. Proficient in C # or Java, join the cloud computing background !!!