User input displayed when submitted

I’d like my user’s input to be seen right when the click the ‘submit’ button. I found code online, but so far the information can not be seen until the page is refreshed after the information is submitted. Below is a copy of the code I have been using but is not working. It’d be very helpful if anyone could let me know what’s wrong with my code.

import wixData from ‘wix-data’;

function getData(){
let query = wixData.query(‘OrderForm input’)

return query.limit(1000).find().then(results => {
console.log(‘getData’, results);
return results.items;
});
}

$w.onReady( () => {

$w("#forminput").onAfterSave( () => { 
    getData().then((items) => { 
        $w("#orderlist").data = items; 
    }); 
}); 

})

Hello Jack,

Make sure of the collection’s name :

let query = wixData.query('OrderForm') 

Massa

1 Like

Thank you very much!! It works perfectly now!