The below block of code asks the server for an adjusted account balance after the user inputs a number to quantity, price and payment fields. Adding --10 to a field would throw an error on the server. That's why I've added the NaN check adjustment === adjustment. This way it should only send the request if the adjustment amount is a number. For some reason though, I'm still getting strange things being sent to the server like --10...
Essentially, I need to only send the request when it is actually a number.
var quantity = $("#id_quantity").val();
    var price = $("#id_price").val();
    var payment = $("#id_payment_amount").val();
    var adjustment = quantity * price - payment;
    // Don't send if Not a number (NaN).
    if (adjustment === adjustment) {
        $.get("/balance_after_adjustment", {amount: adjustment}, function(response) {
            $("span").text(response);
        });
    }
 
     
    