コード例 #1
0
        private async Task <T> execute <T>(String type, object obj)
        {
            var options = new RemoteOptions()
            {
                type  = type,
                url   = Url,
                cache = false,
                data  = JSON.Stringify(obj),
                //data = obj,
                //dataType = "json",
                dataType    = "text",
                contentType = "application/json; charset=utf-8",
                crossDomain = true
            };

            var callback = (Func <string, string, jqXHR, string>)((response, status, xhr) => response);

            var task = Task.FromPromise <string>(LowLevelRemote.ajax(options), callback);

            await task;

            string result = task.Result;

            return(JSON.Parse <T>(result));
        }
コード例 #2
0
 private void execute <T>(String type, String url, object obj, Action <T> callback)
 {
     LowLevelRemote.ajax(
         new RemoteOptions()
     {
         type = type,
         url  = url,
         //data = JSON.Stringify(obj),
         data    = obj,
         success = delegate(object data, string str, jqXHR jqXHR)
         {
             callback((T)data);
         },
         dataType = "json",
         //contentType = "application/json; charset=utf-8"
     }
         );
 }