diff options
Diffstat (limited to 'files/es/web/api/xmlhttprequesteventtarget')
-rw-r--r-- | files/es/web/api/xmlhttprequesteventtarget/index.html | 68 | ||||
-rw-r--r-- | files/es/web/api/xmlhttprequesteventtarget/onload/index.html | 55 |
2 files changed, 123 insertions, 0 deletions
diff --git a/files/es/web/api/xmlhttprequesteventtarget/index.html b/files/es/web/api/xmlhttprequesteventtarget/index.html new file mode 100644 index 0000000000..f53063d82b --- /dev/null +++ b/files/es/web/api/xmlhttprequesteventtarget/index.html @@ -0,0 +1,68 @@ +--- +title: XMLHttpRequestEventTarget +slug: Web/API/XMLHttpRequestEventTarget +tags: + - AJAX + - API + - NeedsBrowserCompatibility + - NeedsContent + - NeedsTranslation + - Reference + - TopicStub + - XMLHttpRequest +translation_of: Web/API/XMLHttpRequestEventTarget +--- +<p>{{APIRef("XMLHttpRequest")}}</p> + +<p><code>XMLHttpRequestEventTarget</code> is the interface that describes the event handlers you can implement in an object that will handle events for an {{ domxref("XMLHttpRequest") }}.</p> + +<p>{{InheritanceDiagram}}</p> + +<h2 id="Properties">Properties</h2> + +<dl> + <dt>{{ domxref("XMLHttpRequestEventTarget.onabort") }}</dt> + <dd>Contains the function to call when a request is aborted and the {{event('abort')}} event is received by this object.</dd> + <dt>{{ domxref("XMLHttpRequestEventTarget.onerror") }}</dt> + <dd>Contains the function to call when a request encounters an error and the {{event('error')}} event is received by this object.</dd> + <dt>{{ domxref("XMLHttpRequestEventTarget.onload") }}</dt> + <dd>Contains the function to call when an HTTP request returns after successfully fetching content and the {{event('load')}} event is received by this object.</dd> + <dt>{{ domxref("XMLHttpRequestEventTarget.onloadstart") }}</dt> + <dd>Contains the function that gets called when the HTTP request first begins loading data and the {{event('loadstart')}} event is received by this object.</dd> + <dt>{{ domxref("XMLHttpRequestEventTarget.onprogress") }}</dt> + <dd>Contains the function that is called periodically with information about the progress of the request and the {{event('progress')}} event is received by this object.</dd> + <dt>{{ domxref("XMLHttpRequestEventTarget.ontimeout") }}</dt> + <dd>Contains the function that is called if the event times out and the {{event("timeout")}} event is received by this object; this only happens if a timeout has been previously established by setting the value of the <code>XMLHttpRequest</code> object's <code>timeout</code> attribute.</dd> + <dt>{{ domxref("XMLHttpRequestEventTarget.onloadend") }}</dt> + <dd>Contains the function that is called when the load is completed, even if the request failed, and the {{event('loadend')}} event is received by this object.</dd> +</dl> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('XMLHttpRequest')}}</td> + <td>{{Spec2('XMLHttpRequest')}}</td> + <td>WHATWG living standard</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.XMLHttpRequestEventTarget")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{ domxref("XMLHttpRequest") }}</li> + <li><a href="/en/DOM/XMLHttpRequest/Using_XMLHttpRequest" title="Using XMLHttpRequest">Using XMLHttpRequest</a></li> +</ul> diff --git a/files/es/web/api/xmlhttprequesteventtarget/onload/index.html b/files/es/web/api/xmlhttprequesteventtarget/onload/index.html new file mode 100644 index 0000000000..c6d6f78974 --- /dev/null +++ b/files/es/web/api/xmlhttprequesteventtarget/onload/index.html @@ -0,0 +1,55 @@ +--- +title: XMLHttpRequestEventTarget.onload +slug: Web/API/XMLHttpRequestEventTarget/onload +translation_of: Web/API/XMLHttpRequestEventTarget/onload +--- +<div>{{APIRef("XMLHttpRequest")}}</div> + +<p>El evento <strong><code>XMLHttpRequestEventTarget.onload</code> </strong>es la función que se llama cuando una transacción del {{domxref("XMLHttpRequest")}} es ejecutada correctamente.</p> + +<h2 id="Syntax" name="Syntax">Sintaxis</h2> + +<pre class="syntaxbox"><em>XMLHttpRequest</em>.onload = <em>callback</em>;</pre> + +<h3 id="Valores"> Valores</h3> + +<ul> + <li><code><em>callback</em></code> is the function to be executed when the request completes successfully. It receives a {{domxref("ProgressEvent")}} object as its first argument. The value of <em>this</em> (i.e. the context) is the same {{domxref("XMLHttpRequest")}} this callback is related to.</li> + <li><code><em>callback</em></code> es la función a ser ejecutada cuando la petición se complete. Ésta recive un objeto {{domxref("ProgressEvent")}} como su primer argumento. El valor de esto (ej: el contexto) es el mismo {{domxref("XMLHttpRequest")}} al que el callback está relacionado.</li> +</ul> + +<h2 id="Example" name="Example">Ejemplo</h2> + +<pre class="brush: js">var xmlhttp = new XMLHttpRequest(), + method = 'GET', + url = 'https://developer.mozilla.org/'; + +xmlhttp.open(<em>method</em>, <em>url</em>, true); +xmlhttp.onload = function () { + // Hacer algo con la información recivida ( found in xmlhttp.response ) +}; +xmlhttp.send(); +</pre> + +<h2 id="Especificaciones">Especificaciones</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}</td> + <td>{{Spec2('XMLHttpRequest')}}</td> + <td>WHATWG living standard</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.XMLHttpRequestEventTarget.onload")}}</p> |