Struct stdweb::web::XmlHttpRequest
[−]
[src]
pub struct XmlHttpRequest(_);
Use XmlHttpRequest (XHR) objects to interact with servers. You can retrieve data from a URL without having to do a full page refresh. This enables a Web page to update just part of a page without disrupting what the user is doing. XmlHttpRequest is used heavily in Ajax programming.
Methods
impl XmlHttpRequest
[src]
pub fn new() -> XmlHttpRequest
[src]
Creates new XmlHttpRequest
.
pub fn ready_state(&self) -> XhrReadyState
[src]
Returns the current state of the request as a XhrReadyState.
pub fn response_text(&self) -> Result<Option<String>, TODO>
[src]
Returns a string that contains the response to the request as text, or None if the request was unsuccessful or has not yet been sent.
pub fn status(&self) -> u16
[src]
Returns an unsigned short with the status of the response of the request.
pub fn open(&self, method: &str, url: &str) -> Result<(), TODO>
[src]
Open connection with given method (ie GET or POST), and the url to hit.
pub fn get_response_header(&self, header: &str) -> Option<String>
[src]
Returns the string containing the text of the specified header. If there are multiple response headers with the same name, then their values are returned as a single concatenated string.
pub fn set_request_header(&self, header: &str, value: &str) -> Result<(), TODO>
[src]
Sets the value of an HTTP request header. Must be called after open()
,
but before send()
. If this method is called several times with the same
header, the values are merged into one single request header.
pub fn send(&self) -> Result<(), TODO>
[src]
Send request on an open connection with no data
pub fn send_with_string(&self, body: &str) -> Result<(), TODO>
[src]
Send request on an open connection with string body
pub fn send_with_bytes(&self, body: &[u8]) -> Result<(), TODO>
[src]
Send request on an open connection with a byte array body
pub fn abort(&self)
[src]
Aborts the request if it has already been sent. When a request is aborted, its ready_state is changed to Done and the status code is set to Unsent.
Trait Implementations
impl Clone for XmlHttpRequest
[src]
fn clone(&self) -> XmlHttpRequest
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for XmlHttpRequest
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl PartialEq for XmlHttpRequest
[src]
fn eq(&self, __arg_0: &XmlHttpRequest) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &XmlHttpRequest) -> bool
[src]
This method tests for !=
.
impl Eq for XmlHttpRequest
[src]
impl From<XmlHttpRequest> for EventTarget
[src]
fn from(value: XmlHttpRequest) -> Self
[src]
Performs the conversion.
impl TryFrom<EventTarget> for XmlHttpRequest
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: EventTarget) -> Result<Self, Self::Error>
[src]
Performs the conversion.
impl InstanceOf for XmlHttpRequest
[src]
fn instance_of(reference: &Reference) -> bool
[src]
Checks whenever a given Reference if of type Self
.
impl AsRef<Reference> for XmlHttpRequest
[src]
impl ReferenceType for XmlHttpRequest
[src]
unsafe fn from_reference_unchecked(reference: Reference) -> Self
[src]
Converts a given reference into a concrete reference-like wrapper. Doesn't do any type checking; highly unsafe to use! Read more
impl From<XmlHttpRequest> for Reference
[src]
fn from(value: XmlHttpRequest) -> Self
[src]
Performs the conversion.
impl TryFrom<XmlHttpRequest> for Reference
[src]
type Error = Void
The type returned in the event of a conversion error.
fn try_from(value: XmlHttpRequest) -> Result<Self, Self::Error>
[src]
Performs the conversion.
impl TryFrom<Reference> for XmlHttpRequest
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: Reference) -> Result<Self, Self::Error>
[src]
Performs the conversion.
impl<'_r> TryFrom<&'_r Reference> for XmlHttpRequest
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: &Reference) -> Result<Self, Self::Error>
[src]
Performs the conversion.
impl TryFrom<Value> for XmlHttpRequest
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error>
[src]
Performs the conversion.
impl<'_r> TryFrom<&'_r Value> for XmlHttpRequest
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &Value) -> Result<Self, Self::Error>
[src]
Performs the conversion.
impl JsSerialize for XmlHttpRequest
[src]
impl IEventTarget for XmlHttpRequest
[src]
fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandle where
T: ConcreteEvent,
F: FnMut(T) + 'static,
[src]
T: ConcreteEvent,
F: FnMut(T) + 'static,
Adds given event handler to the list the list of event listeners for the specified EventTarget
on which it's called. Read more
fn dispatch_event<T: IEvent>(&self, event: &T) -> Result<bool, TODO>
[src]
Dispatches an Event
at this EventTarget
, invoking the affected event listeners in the appropriate order. Read more