I want to know how I can save the id for an object added to an object store?
I know I can get the id with the request.result of the onsuccess function but I want to save like this:
//after a get
var id;
request.onsuccess = function(event){
    id = request.result.id;
}
alert(id); //undefined
I have seen another answers and all say how to show the id in the onsuccess function:
request.onsuccess = function(event){
    alert(request.result.id);
}
but I want to save the id to use outside the onsuccess.
