[−][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]
impl XmlHttpRequest
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( | [src] |
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 JsSerialize for XmlHttpRequest
impl TryFrom<EventTarget> for XmlHttpRequest
[src]
impl TryFrom<EventTarget> for XmlHttpRequest
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]
impl TryFrom<XmlHttpRequest> for Reference
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]
impl TryFrom<Reference> for XmlHttpRequest
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]
impl<'_r> TryFrom<&'_r Reference> for XmlHttpRequest
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]
impl TryFrom<Value> for XmlHttpRequest
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]
impl<'_r> TryFrom<&'_r Value> for XmlHttpRequest
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]
impl InstanceOf for XmlHttpRequest
fn instance_of(reference: &Reference) -> bool | [src] |
impl ReferenceType for XmlHttpRequest
[src]
impl ReferenceType for XmlHttpRequest
unsafe fn from_reference_unchecked(reference: Reference) -> Self | [src] |
impl IEventTarget for XmlHttpRequest
[src]
impl IEventTarget for XmlHttpRequest
fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandle where | [src] |
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 From<XmlHttpRequest> for EventTarget
[src]
impl From<XmlHttpRequest> for EventTarget
fn from(value: XmlHttpRequest) -> Self | [src] |
impl From<XmlHttpRequest> for Reference
[src]
impl From<XmlHttpRequest> for Reference
fn from(value: XmlHttpRequest) -> Self | [src] |
impl Eq for XmlHttpRequest
[src]
impl Eq for XmlHttpRequest
impl PartialEq<XmlHttpRequest> for XmlHttpRequest
[src]
impl PartialEq<XmlHttpRequest> for XmlHttpRequest
fn eq(&self, other: &XmlHttpRequest) -> bool | [src] |
fn ne(&self, other: &XmlHttpRequest) -> bool | [src] |
impl AsRef<Reference> for XmlHttpRequest
[src]
impl AsRef<Reference> for XmlHttpRequest
impl Clone for XmlHttpRequest
[src]
impl Clone for XmlHttpRequest
fn clone(&self) -> XmlHttpRequest | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source
. Read more
impl Debug for XmlHttpRequest
[src]
impl Debug for XmlHttpRequest
Auto Trait Implementations
impl Send for XmlHttpRequest
impl Send for XmlHttpRequest
impl Sync for XmlHttpRequest
impl Sync for XmlHttpRequest
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |