Example #1
0
    public static void PostData(string url, object data, AjaxRequestCallback succesCallback, AjaxErrorCallback errorCallback, string returnType, string requestType)
    {
        returnType  = returnType ?? "text";
        requestType = requestType ?? "POST";

        jQuery.Ajax(new jQueryAjaxOptions(
                        "cache", false,
                        "data", data,
                        "dataType", returnType,
                        "error", (AjaxErrorCallback) delegate(jQueryXmlHttpRequest req, string textStatus, Exception error) {
            if (!Script.IsNullOrUndefined(errorCallback))
            {
                errorCallback(req, textStatus, error);
            }
        },
                        "success", (AjaxRequestCallback) delegate(object dataSuccess, string textStatus, jQueryXmlHttpRequest request) {
            if (Script.IsNullOrUndefined(succesCallback))
            {
                jQuery.Document.Append((string)dataSuccess);
            }
            else
            {
                succesCallback(dataSuccess, textStatus, request);
            }
        },
                        "type", requestType,
                        "url", url));
    }
Example #2
0
        public static void PostComplexToMVC(string url, Dictionary formData, AjaxRequestCallback <object> ajaxRequestCallback)
        {
            //jQueryAjaxOptions ajaxOptions = new jQueryAjaxOptions();
            //ajaxOptions.Url = AppendUrlTimeStamp(url);
            //ajaxOptions.Type = "POST";
            //ajaxOptions.DataType = "json";
            //ajaxOptions.ContentType = "application/json; charset=utf-8";
            //ajaxOptions.Data = Json.toJSON(data);
            //ajaxOptions.Success = ajaxRequestCallback;
            //jQuery.Ajax(ajaxOptions);
            Postify mvcPostify = new Postify();
            object  data       = mvcPostify.CreatePropertyObject(formData);
            object  postData   = mvcPostify.Parse(data, 10);

            Logging.Debug("Posting Complex Data Object for Asp.net MVC", new object[] { postData });
            jQuery.Post(AppendUrlTimeStamp(url), postData, ajaxRequestCallback);
        }
Example #3
0
        public static void PostComplexToMVC(string url, Dictionary formData, AjaxRequestCallback<object> ajaxRequestCallback)
        {
            //jQueryAjaxOptions ajaxOptions = new jQueryAjaxOptions();
            //ajaxOptions.Url = AppendUrlTimeStamp(url);
            //ajaxOptions.Type = "POST";
            //ajaxOptions.DataType = "json";
            //ajaxOptions.ContentType = "application/json; charset=utf-8";
            //ajaxOptions.Data = Json.toJSON(data);
            //ajaxOptions.Success = ajaxRequestCallback;
            //jQuery.Ajax(ajaxOptions);
            Postify mvcPostify = new Postify();
            object data = mvcPostify.CreatePropertyObject(formData);
            object postData = mvcPostify.Parse(data, 10);

            Logging.Debug("Posting Complex Data Object for Asp.net MVC", new object[] { postData });
            jQuery.Post(AppendUrlTimeStamp(url), postData, ajaxRequestCallback);
        }
Example #4
0
    public static void PostData(string url, object data, AjaxRequestCallback succesCallback, AjaxErrorCallback errorCallback, string returnType, string requestType) {
        returnType = returnType ?? "text";
        requestType = requestType ?? "POST";

        jQuery.Ajax(new jQueryAjaxOptions(
            "cache", false,
            "data", data,
            "dataType", returnType,
            "error", (AjaxErrorCallback)delegate(jQueryXmlHttpRequest req, string textStatus, Exception error) {
                if (!Script.IsNullOrUndefined(errorCallback))
                    errorCallback(req, textStatus, error);
            },
            "success", (AjaxRequestCallback)delegate(object dataSuccess, string textStatus, jQueryXmlHttpRequest request) {
                if (Script.IsNullOrUndefined(succesCallback)) {
                    jQuery.Document.Append((string)dataSuccess);
                }
                else {
                    succesCallback(dataSuccess, textStatus, request);
                }
            },
            "type", requestType,
            "url", url));
    }
Example #5
0
 /// <summary>
 /// Adds a callback to handle a successful completion of the request.
 /// </summary>
 /// <param name="callback">The callback to invoke.</param>
 /// <returns>The current request object.</returns>
 public jQueryDataHttpRequest <TData> Success(AjaxRequestCallback <TData> callback)
 {
     return(null);
 }
 /// <summary>
 /// Adds a callback to handle a successful completion of the request.
 /// </summary>
 /// <param name="callback">The callback to invoke.</param>
 /// <returns>The current request object.</returns>
 public jQueryXmlHttpRequest Success(AjaxRequestCallback callback)
 {
     return(null);
 }
Example #7
0
 public static jQueryDataHttpRequest <TData> GetData <TData>(string url, object data, AjaxRequestCallback <TData> callback, string dataType)
 {
     return(null);
 }
Example #8
0
 /// <summary>
 /// Load data from the server using a HTTP GET request.
 /// </summary>
 /// <param name="url">The URL to request.</param>
 /// <param name="data">A string or dictionary containing the data sent with the request.</param>
 /// <param name="callback">The callback to invoke with the response.</param>
 /// <param name="dataType">The type of data expected in the response.</param>
 /// <returns>The jQueryXmlHttpRequest object.</returns>
 public static jQueryXmlHttpRequest Get(string url, object data, AjaxRequestCallback <object> callback, string dataType)
 {
     return(null);
 }
Example #9
0
 public static jQueryDataHttpRequest <TData> PostRequest <TData>(string url, object data, AjaxRequestCallback <TData> callback)
 {
     return(null);
 }
Example #10
0
 /// <summary>
 /// Post data to the server using a HTTP POST request.
 /// </summary>
 /// <param name="url">The URL to request.</param>
 /// <param name="data">A string or dictionary containing the data sent with the request.</param>
 /// <param name="callback">The callback to invoke with the response.</param>
 /// <returns>The jQueryXmlHttpRequest object.</returns>
 public static jQueryXmlHttpRequest Post(string url, object data, AjaxRequestCallback <object> callback)
 {
     return(null);
 }
 /// <summary>
 /// Adds a callback to handle a successful completion of the request.
 /// </summary>
 /// <param name="callback">The callback to invoke.</param>
 /// <returns>The current request object.</returns>
 public jQueryXmlHttpRequest Success(AjaxRequestCallback callback)
 {
     return null;
 }
Example #12
0
 public static void Post(string url, object formData, AjaxRequestCallback <object> ajaxRequestCallback)
 {
     jQuery.Post(AppendUrlTimeStamp(url), formData, ajaxRequestCallback);
 }
Example #13
0
 public static void Post(string url, object formData, AjaxRequestCallback<object> ajaxRequestCallback)
 {
     jQuery.Post(AppendUrlTimeStamp(url), formData, ajaxRequestCallback);
 }
Example #14
0
        public static jQueryXmlHttpRequest Ajax(JsDictionary <string, object> data, string url, bool post, AjaxRequestCallback success, AjaxErrorCallback error)
        {
            var converters = new JsDictionary <string, Func <string, object> >();

            converters["text json"] = EvalJson;
            return(jQuery.Ajax(new jQueryAjaxOptions {
                Data = data, Converters = converters, DataType = "json", Cache = false, Type = post ? "POST" : "GET", Url = url, Success = success, Error = error
            }));
        }