WixData.query fails when page is published

I am trying to execute code that does a wixData.query on my dataset. It works in preview in dev mode and returns data but when the page is published it doesn’t return any data.

I have attached a screenshot of the code I am trying to use.

Any help would be very appreciated.

Thank you

Zoe

  1. Checked DB-Permissions?
  2. Synced LIVE and PREVIEW-DB ?

DB is set to read and write which i believe is correct for what i want it to do

And I have synced sandbox to live but it still doesnt work

your page is probably giving an error in the console.
the following code would probabbly be the fault.
$w(“#dataset1”)
Also .eq().eq() isn’t possible.

Youshould use the and/or betweeen it.
More info can be found here: https://www.wix.com/velo/reference/wix-data/wixdataquery/and

Kind regards,
Kristof

Please check the following one by one: -

  • Check database permissions
  • Sync sandbox & live Databases
  • Wrong code i.e. $w(“#dataset1”) is nothing. You should use the code in page’s onReady function. As you’re using this in another function then call that function. Because here I didn’t see any calling.
$w("#dataset1").onReady((){
....your code here
})
  • Also for strings, always use .contains() instead of .eq()

Please try this & let me know if still there is any issue.