success

  • Revision slug: Web/Reference/Events/success_indexedDB
  • Revision title: success
  • Revision id: 403083
  • Created:
  • Creator: Sheppy
  • Is current revision? Yes
  • Comment Moved From DOM/Mozilla_event_reference/success_indexedDB to Web/Reference/Events/success_indexedDB

Revision Content

The success handler is executed when a request succeed.

General info

Specification
IndexedDB
Interface
Event
Bubbles
No
Cancelable
No
Target
IDBFactory, IDBRequest
Default Action
None

Properties

{{OpenEventProperties("The request concerned by this event")}}{{CloseEventProperties()}}

Example

var request = indexedDB.open("addressbook", 3);

// using the onsuccess handler to access a database, once open
request.onsuccess = function( event ) {
  var addressbookDB = event.target.result;

}

// which is equivalent to
request.addEventListener("success", function( event ) {
  var addressbookDB = event.target.result;

});

{{IDBRelatedEvents()}}

See also

Revision Source

<p>The <code>success</code> handler is executed when a request succeed.</p>
<h2 id="General_info">General info</h2>
<dl>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Specification</dt>
  <dd style="margin: 0 0 0 120px;">
    <a class="external" href="http://www.w3.org/TR/IndexedDB/#request-api">IndexedDB</a></dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Interface</dt>
  <dd style="margin: 0 0 0 120px;">
    Event</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Bubbles</dt>
  <dd style="margin: 0 0 0 120px;">
    No</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Cancelable</dt>
  <dd style="margin: 0 0 0 120px;">
    No</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Target</dt>
  <dd style="margin: 0 0 0 120px;">
    IDBFactory, IDBRequest</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Default Action</dt>
  <dd style="margin: 0 0 0 120px;">
    None</dd>
</dl>
<h2 id="Properties">Properties</h2>
<p>{{OpenEventProperties("The request concerned by this event")}}{{CloseEventProperties()}}</p>
<h2 id="Example">Example</h2>
<pre class="brush:js;">
var request = indexedDB.open("addressbook", 3);

// using the onsuccess handler to access a database, once open
request.onsuccess = function( event ) {
  var addressbookDB = event.target.result;

}

// which is equivalent to
request.addEventListener("success", function( event ) {
  var addressbookDB = event.target.result;

});
</pre>
<h2 id="Related_Events">Related Events</h2>
<p>{{IDBRelatedEvents()}}</p>
<h2 id="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/IndexedDB/Using_IndexedDB">Using IndexedDB</a></li>
</ul>
Revert to this revision