using AJAX [object Object]

These lines are responsible for the alert:

success: function(data) {
    window.alert(data);
},
error: function(errorThrown){
    window.alert(errorThrown);
}

In the first block, success, the callback function is executed if the ajax request succeded. The second block, error, will run if the request returned an error.

Right now in both cases an alert is triggered via window.alert() function call. You should replace these calls with your own logic.

To start, replace them with console.log() calls passing the data you’re interested in. Then open your browser’s console and check the data printed there.

If you see 400 error in the console with WordPress, check this answer:

https://stackoverflow.com/questions/48025825/wordpress-admin-ajax-php-400-bad-request/48026371#48026371.