[][src]Struct stdweb::web::XmlHttpRequest

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.

(JavaScript docs)

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.

(JavaScript docs)

pub fn response_type(&self) -> XhrResponseType[src]

Returns the type of the request as a XhrResponseType

(JavaScript docs)

pub fn set_response_type(
    &self,
    kind: XhrResponseType
) -> Result<(), XhrSetResponseTypeError>
[src]

Set the type that the XmlHttpRequest should return

(JavaScript docs)

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.

(JavaScript docs)

pub fn raw_response(&self) -> Value[src]

Returns the object representing the response

(JavaScript docs)

pub fn status(&self) -> u16[src]

Returns an unsigned short with the status of the response of the request.

(JavaScript docs)

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.

(JavaScript docs)

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.

(JavaScript docs)

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.

(JavaScript docs)

pub fn send(&self) -> Result<(), TODO>[src]

Send request on an open connection with no data

(JavaScript docs)

pub fn send_with_string(&self, body: &str) -> Result<(), TODO>[src]

Send request on an open connection with string body

(JavaScript docs)

pub fn send_with_bytes(&self, body: &[u8]) -> Result<(), TODO>[src]

Send request on an open connection with a byte array body

(JavaScript docs)

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.

(JavaScript docs)

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.

impl TryFrom<XmlHttpRequest> for Reference[src]

type Error = Void

The type returned in the event of a conversion error.

impl TryFrom<Reference> for XmlHttpRequest[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_r> TryFrom<&'_r Reference> for XmlHttpRequest[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<Value> for XmlHttpRequest[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_r> TryFrom<&'_r Value> for XmlHttpRequest[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl InstanceOf for XmlHttpRequest[src]

impl ReferenceType for XmlHttpRequest[src]

impl IEventTarget for XmlHttpRequest[src]

impl AsRef<Reference> for XmlHttpRequest[src]

impl From<XmlHttpRequest> for EventTarget[src]

impl From<XmlHttpRequest> for Reference[src]

impl Clone for XmlHttpRequest[src]

impl Eq for XmlHttpRequest[src]

impl PartialEq<XmlHttpRequest> for XmlHttpRequest[src]

impl Debug for XmlHttpRequest[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]