Example #1
0
        public static void SendJson(this XMLHttpRequest xmlHttpRequest, object obj)
        {
            var data = Window.Json.Stringify(XMLHttpRequestHelper.Encode(obj));

            xmlHttpRequest.SetRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlHttpRequest.Send(data);
        }
Example #2
0
 public static void SetTimeout(this XMLHttpRequest xmlHttpRequest, TimeSpan timeout)
 {
     xmlHttpRequest.Timeout = (uint)timeout.TotalMilliseconds;
 }
Example #3
0
 public static TimeSpan GetTimeout(this XMLHttpRequest xmlHttpRequest)
 {
     return(TimeSpan.FromMilliseconds(xmlHttpRequest.Timeout));
 }
Example #4
0
 public static T RecvJson <T>(this XMLHttpRequest xmlHttpRequest)
 {
     return((T)XMLHttpRequestHelper.Decode(Window.Json.Parse(xmlHttpRequest.ResponseText)));
 }