You can’t have two page onReady functions like that, use one or the other.
https://www.wix.com/corvid/reference/$w.html#onReady
Read the API reference for getCurrentItem, it gives you code examples…
Get the dataset’s current item when the page loads
$w.onReady( () => {
$w("#myDataset").onReady( () => {
let itemObj = $w("#myDataset").getCurrentItem();
} );
} );