update database in phonegap-Collection of common programming errors

I’m getting the following error:

Uncaught Error: INVALID_STATE_ERR: DOM Exception 11

I get this error message when trying to execute a query.

Did anyone ever get the same problem ?

function populateDB(tx) {

    tx.executeSql('DROP TABLE IF EXISTS ORDERS');
    tx.executeSql('CREATE TABLE IF NOT EXISTS ORDERS (id INTEGER PRIMARY KEY, client_ID, status)');

    var myurl="xml.xml";
    $.ajax({
        type: "POST", 
        url: myurl, 
        dataType: "xml", 
        success: onSuccess
    }); 
}

function onSuccess(xml) {

    $(xml).find('articles').each(function () {
        var idord = $(this).attr('id');

        var esql ='INSERT INTO ORDERS (id, client_ID, status) VALUES ('+idord+', 4, "done" )';
        var nameclient = $(this).find('name').text();
        $('.items').append('

'+ nameclient '

').appendTo('#xml-data'); 

        tx.executeSql(esql) ;
    });  
}