AJAX错误:连接被拒绝?

I'm running a Digital Ocean server here on a MEN stack (MongoDB, Express, and Node), with a registration form: http://45.55.177.167:3000/register

If you try to select an option from the dropdown, I'm getting the following error: GET http://45.55.177.167:3000/price?name=pro&cycle=monthly net::ERR_CONNECTION_REFUSED

I'm wondering why this is? I would like for the error to go away and get the response back so that the price changes accordingly.

My AJAX method:

$.get('/price', parameters, function(data) {
    callback(data.price);
});

The Route: app.route('/price').get(plans.getPrice);

The Controller:

var param_name = req.query.name;
var param_cycle = req.query.cycle;

var query = param_name + "_" + param_cycle;

Plan.findByName(query, function(err, selected_plan) {
    var formatted_price = format_price(selected_plan.price) + '.00';
    res.send({price: formatted_price});
});

This is working fine on my localhost, but when I deploy it to a droplet, I'm getting the error. Please let me know if clarification is needed.

After checking your ip, I determined that your problem was data. You were getting the error "refused connection" because the app didn't have any sanity tests on the expected object parameters it was operating on. Without data, trying to access properties that were undefined was throwing errors, causing your app to break without and return the error you saw in the client.

We didn't change any of your code to resolve this issue. Your project can be considered done.

Migrating your data from your local mongo db collections to your remote host resolved the issue. As I demonstrated, there is a simple fix for quickly migrating simple data structures over: connect to mongo on the command line, select your database, and find() each of your collections. As you noticed, they are simply JSON objects that can be copy-pasta'd to the new remote destination's insert() statement with minimal modification.

This isn't an advisable solution for situations with more data than simply structured, limited data in a handful of collections; you'd want to use a programmatic solution such as dumping the db for anything larger than we were working with here.