The body of my jquery post request to my mongodb database is always empty for some reason. I've tried the same post request on other applications like insomnia and python on the terminal.

Hovewer, this html script which is in the same directory as that of the express server is unable to send a post request

code : 

```
$("form").submit(function (event) {

            //getting the form data
            var input_values = $(this).serializeArray();
            var post_JSON = {};
            $.each(input_values, function (i, field) {
                post_JSON[field.name] = field.value;
            });
            console.log(JSON.stringify(post_JSON));

            //Post request to mongo db
            $.post("http://localhost:5000/users/add",                   // url
                JSON.stringify(post_JSON),                              // data to be submit

                function (data, status, jqXHR) {                        // success callback
                    console.log('status: ' + status + ', data: ' + data);
                },

                "json")
                .fail(function (xhr, status, error) {
                    console.log(xhr);
                });

```

the schema of user defined with mongoose schemas : 

```
var UserSchema = new Schema({
    username: {
        type: String,
        required: true,
        trim: true,
    },
    password: {
        type: String,
        required: true,
    },
    favourites: [String],
    profile_img: Buffer,
    email: {
        type: String,
        match: /.+@.+/i, //Validates email ids
        unique: true,
        required: true,
    },
    search_history: [String],
    phone_number: {
        type: String,
        maxlength: 10,
        match: /^\d{10}$/,  //Validates phone number
    },
});

const User = mongoose.model('User', UserSchema);

module.exports = User;

```

here is the console error log : 
[![enter image description here](https://i.stack.imgur.com/XipVt.png)](https://i.stack.imgur.com/XipVt.png)

The json right before the bad post request errror is the actual data that I am attempting to send to the database. If I were to copy paste this json and try the post in insomnia, it works. But I need it to work here.