Compare 2 input fields to a wix database

Try this code:

import wixData from "wix-data"
import wixLocation from "wix-location"

$w.onReady(() => {
    $w("#gg").onClick(() => {
 let username = $w("#name").value
 let password = $w("#lname").value
        wixData
 .query("Profile")
 .eq("firstName", username)
 .eq("lastName", password)
 //make sure the field names that you search in the query
 //are the same as the actual fields in the data base.
 .find()
 .then(results => {
 if (results.length > 0) {
                    wixLocation.to(`/profile/` + firstName)
 // using the wix location API,
 // make sure you return the full destination URL
 }
 })
 .catch(err => {
                console.log("err", err)
 })
 })
})


Remember to delete any event handler attached to the gg button.