public void SendCommand(string command, object data)
        {
            var ajaxSettings = new AjaxSettings
            {
                url = "http://localhost:1337/" + command,
                cache = false,
                data = data,
                dataType = "",
                // success = Success
            };

            jQuery.ajax(ajaxSettings);
        }
        public static void ConnectToServer()
        {
            var ajaxSettings = new AjaxSettings
            {
                url = "localhost:1337/InitialConnection",
                cache = false,
                data = "{}",
                dataType = "",
                success = Success
            };

            //jQuery.ajax(ajaxSettings);
            _networkConnector.SendQuery("InitialConnect", null);
        }
        public object SendQuery(string query, object data)
        {
            var ajaxSettings = new AjaxSettings
            {
                url = "http://localhost:1337/" + query,
                cache = false,
                data = data,
                dataType = "",
                // success = Success
            };

            jQuery.ajax(ajaxSettings);

            return "";
        }
Esempio n. 4
0
 /// <summary>
 /// Set default values for future Ajax requests.
 /// </summary>
 public static void ajaxSetup(AjaxSettings options) { }
Esempio n. 5
0
        private void SendInternal(string httpMethod, string type, JsString url, object data,
            JsAction<object, JsString, jqXHR> success,
            JsAction<JsError, JsString, jqXHR> failed)
        {
            url = addTimeToUrl(url);

            JsObject headers = new JsObject();
            AjaxSettings ajaxSettings = new AjaxSettings
            {
                type = httpMethod,
                dataType = type,
                data = data,
                url = jsUtils.inst.getLocation() + "/" + url,
                headers = headers,
                success = delegate(object o, JsString s, jqXHR arg3) { success(o, s, arg3); },
                error = delegate(jqXHR xhr, JsString s, JsError arg3) { failed(arg3, s, xhr); }
            };
            bool isString = data.As<JsObject>()["toLowerCase"] != null;
            if (isString)
            {
                ajaxSettings.processData = true;
                ajaxSettings.contentType = (type.As<JsString>().toLowerCase() == "xml")
                    ? "application/xml"
                    : "application/json";
            }

            jQuery.ajax(
                ajaxSettings);
        }