OnClick & Sending Data Issue

Hello All,

I am having a small issue sending data to my database.
I have a registration page that sends information to the WIX CRM. (This Works)
The code i am using is this;

import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
$w.onReady(function(){  
$w('#register').onClick(function (){    
 let email = $w('#email').value; 
 let password = $w('#password').value;   
        wixUsers.register(email,password)   
        .then(()=>{
            wixLocation.to('/dashboard'); 
            })
        })
    })

I also have the button that I have the on click event linked to to send data to a data base.
This is not working.

Any help?

Hello Simon,

When you register the user can you add a .catch to your promise so that we can see what the error message is telling us?

Like so: (excuse the formatting)

 import wixUsers from 'wix-users'; 
 import wixLocation from 'wix-location'; 
 
 $w.onReady(function(){ 
   $w('#register').onClick(function (){ 
     let email = $w('#email').value; 
     let password = $w('#password').value;                 wixUsers.register(email,password) 
 .then(()=>{ 
 wixLocation.to('/dashboard'); 
  }).catch((err)=> {
  console.log(err, "here is the error");
  })
 }) 
 }) 

Best,
Majd