First of all, always use only one $w.onReady per page code, and put everything you need inside.
Second, if you wish to run a query on button click do something like this:
import wixData from 'wix-data';
$w.onReady(() => {
$w('#buttonbID').onClick(runQuery);
});
function runQuery(){
wixData.query('Collection').find()
.then(r => {
const items = r.items;
//Do whatever you want with the results
})
}
If you wish to run 2 queries at once:
import wixData from 'wix-data';
$w.onReady(() => {
$w('#buttonbID').onClick(runQuery);
});
function runQuery(){
Promise.all([
wixData.query('Collection1').find(),
wixData.query('Collection2').find()
])
.then(r => {
const itmes1 = r[0].items;
const items2 = r[1].items;
//Do whatever you want with the results
})
}