Populating data based on querystring


I am trying to load data based on the querystring. Below is the code I have but its not working.

// API Reference: Introduction - Velo API Reference - Wix.com
// “Hello, World!” Example: Velo Learning Center
import wixLocation from ‘wix-location’ ;
import wixData from ‘wix-data’ ;

$w.onReady( function () {
let queryUser = wixLocation.query[ ‘user’ ];
wixData.query( “Wedding_Inquiry” ) --this is the name of the database hooked with the form
.eq( ‘Email’ ,queryUser)
console.log(JSON.stringify(results)); --i cannot see any results in the console window
//let item = results.items[0];
//$w(‘#userName’).value = item.Email; --when i enable this line, i cannot see anything populated
. catch ((err)=>{console.log(err)});

Need helps pls :slight_smile:


You should use more console-logs to inspect your own code a little bit more.

Do you get your wished result for —> console.log(queryUser)
Do you get your wished result for —> console.log(results)

import wixLocation from 'wix-location';
import wixData from 'wix-data';

$w.onReady(function () {
    let queryUser = wixLocation.query['user'];  console.log(queryUser)


Find out which of the two results do not work.
Could it be —> ‘Email’, which is wrong?
Check again the ‘Email’-ID of your -datafield in your DB.
Check also the right ID of your wished DB —> “Wedding_Inquiry”