[−][src]Struct stdweb::web::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_type(&self) -> XhrResponseType
[src]
Returns the type of the request as a XhrResponseType
pub fn set_response_type(
&self,
kind: XhrResponseType
) -> Result<(), XhrSetResponseTypeError>
[src]
&self,
kind: XhrResponseType
) -> Result<(), XhrSetResponseTypeError>
Set the type that the XmlHttpRequest should return
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 raw_response(&self) -> Value
[src]
Returns the object representing the response
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 JsSerialize for XmlHttpRequest
[src]
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]
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]
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]
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]
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]
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]
impl InstanceOf for XmlHttpRequest
[src]
fn instance_of(reference: &Reference) -> bool
[src]
impl ReferenceType for XmlHttpRequest
[src]
unsafe fn from_reference_unchecked(reference: Reference) -> Self
[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 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
impl Eq for XmlHttpRequest
[src]
impl PartialEq<XmlHttpRequest> for XmlHttpRequest
[src]
fn eq(&self, other: &XmlHttpRequest) -> bool
[src]
fn ne(&self, other: &XmlHttpRequest) -> bool
[src]
impl AsRef<Reference> for XmlHttpRequest
[src]
impl Clone for XmlHttpRequest
[src]
fn clone(&self) -> XmlHttpRequest
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<XmlHttpRequest> for EventTarget
[src]
fn from(value: XmlHttpRequest) -> Self
[src]
impl From<XmlHttpRequest> for Reference
[src]
fn from(value: XmlHttpRequest) -> Self
[src]
impl Debug for XmlHttpRequest
[src]
Auto Trait Implementations
impl Send for XmlHttpRequest
impl Sync for XmlHttpRequest
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,