<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest ()
(
if (window.ActiveXObject)
(
xmlHttp = new ActiveXObject ( "Microsoft.XMLHTTP");
)
else if (window.XMLHttpRequest)
(
xmlHttp = new XMLHttpRequest ();
)
)
/ / [(Name: "Zhang", Class: 4), (Name: "Li", Class: 5)]
function doJSON ()
(
createXMLHttpRequest ();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open ( "post", "dojson.aspx", true);
xmlHttp.setRequestHeader ( "content-type", "application / x-www-form-urlencode");
xmlHttp.send ((Name: "Zhang", Class: 4), (Name: "Li", Class: 5));
)
function handleStateChange ()
(
if (xmlHttp.readyState == 4)
(
if (xmlHttp.status == 200)
(
alert ( "is ok !!!");
)
)
)
</ script>
c #
protected void Page_Load (object sender, EventArgs e)
(
byte [] b = new byte [this.Request.InputStream.Length];
this.Request.InputStream.Read (b, 0, b.Length);
string s = System.Text.Encoding.Default.GetString (b);
student s1 = (student) JavaScriptConvert.DeserializeObject (s, typeof (student));
)
public class student
(
public string Name
(
get (;)
set (;)
)
public string Class
(
get (;)
set (;)
)
);
Components needed to download
http://james.newtonking.com/ |