public static async void UpdateButton_Click(jQueryEvent e) { jQuery btn = null; var delay = 0; if (e != null) { btn = new jQuery(e.CurrentTarget); btn.ButtonLoading(); delay = 2000; } // Delaying is to demonstrate the Button Loading state functionality of Bootstrap await Task.Delay(delay); jQuery.Ajax( new AjaxOptions() { Url = Config.GET_SERVER_TIME_URL, Cache = false, Success = delegate(object data, string textStatus, jqXHR request) { if (btn != null) { btn.ButtonReset(); } var val = JSON.Parse <string>((string)data); var dateTime = DateTime.ParseExact(val, "yyyy-MM-ddTHH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); jQuery.Select("#dateTimeInput").Val(dateTime.ToString("yyyy-MM-dd HH:mm:ss")); } } ); }