//Possibility to query (documentation): http://www.random.org/clients/http/ private void button1_Click(object sender, EventArgs e) { var panel = this.Notify("Please wait...", -1, 0.3, Color.Green, Color.Black, Color.White); var options = new AjaxRequestOptions { //You can also delete the Data object and add this to the URL: //?min=1&max=52&col=1&format=plain&rnd=new //It will behave identical, butshow that both options (Data and URL) are possible. Data = new { min = 1, max = 52, col = 1, format = "plain", rnd = "new" }, Url = textBox2.Text, Type = (AjaxRequestType)Enum.Parse(typeof(AjaxRequestType), comboBox1.SelectedItem.ToString()), Complete = (s, ev) => { Controls.Remove(panel); panel.Dispose(); }, Success = (s, ev) => { textBox1.Text = ev.ResponseText.Replace("\n", "\r\n"); textBox3.Text = MakeHeaders(s); } }; options.AddStatusCodeHandler(System.Net.HttpStatusCode.OK, (s, ev) => { MessageBox.Show("I received something with StatusCode 200!"); }); AjaxRequest.Create(options); }
/// <summary> /// Initializes a new instance of the <see cref="AjaxResponseEventArgs"/> class. /// </summary> /// <param name="options">The options.</param> /// <param name="text">The text.</param> /// <param name="response">The response.</param> public AjaxResponseEventArgs(AjaxRequestOptions options, string text, object response) : base(options) { ResponseText = text; Response = response; }
/// <summary> /// The Constructor. /// </summary> /// <param name="options">The given AjaxRequest options.</param> /// <param name="data">The received data as a string.</param> public DataFilterEventArgs(AjaxRequestOptions options, string data) : base(options) { OriginalData = data; ModifiedData = data; }