using AJAX [object Object]

These lines are responsible for the alert:

success: function(data) {
error: function(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: