[HELP][FiveM][ESX] Uncaught (in promise) ReferenceError: amount is not defined

Hey guys,
I get the problem “Uncaught (in promise) ReferenceError: amount is not defined” in one resource.
The Console also says it is based in “nui/script.js:1086”
I dont know whats wrong… maybe you can help?
If you need any information feel free to ask :slight_smile:

Pic about the code in script.js:1086

Code:

    var obj;
    if (type == Lang[config.lang].vehicles_page_title) {
        obj = {product_id: product, plate: plate, name: name, type: 0, price: value, features: `${color}|${tune}`, class: classe, premium: premium, image: imageLink}
    } else if (type == Lang[config.lang].items_page_title) {
        obj = {product_id: product, name: name, type: 1, price: value, amount: amount, class: classe, premium: premium}
    }

    $.post("http://ecommerce/insertItem", JSON.stringify(obj), function (datab) {
        if (datab === true) {
            alertBox(Lang[config.lang].notify_created, 'rgb(54, 233, 158)', 'images/check.svg')
        } else if (datab === 1) {
            alertBox(Lang[config.lang].notify_insufficient_money_premium, 'rgb(251, 99, 99)', 'images/close.svg')
        } else if (datab === 2) {
            alertBox(Lang[config.lang].notify_no_item, 'rgb(251, 99, 99)', 'images/close.svg')
        } else if (datab === 3) {
            alertBox(Lang[config.lang].notify_blacklisted_item, 'rgb(251, 99, 99)', 'images/close.svg')
        } else if (datab === 4) {
            alertBox(Lang[config.lang].notify_invalid_value, 'rgb(251, 99, 99)', 'images/close.svg')
        }
        closePost()
    });
}

Thanks for your help :slight_smile:

Hello, can you show me what do you past to “value” of the price? i think “value” is not defined before

Hello, basically the error occurs when you add an item to the shop and click on “sell product”.

I selected “Burger” from the drop down menu at the top. Then entered a name, value 10 and amount 1, then just selected a category. (It doesn’t matter what you try to insert)

After clicking on “Sell Product” this happens:

It starts a loading loop that never ends and the console is giving me this error.

did you try to see if the amount value is correctly past to the script ? that’s like he’s not recognize the value after clicking on “Sell product”

How can i check that? I am not really familar with JS/JQuery :smiley:

Try to check in the index.html if you found the value “amount” because it’s surely a form under this , sorry , i’m not the best person to explain what to do :sweat_smile:

So in the index.html i searched for “value” and “amount”… both words give no results… In general the index.html looks quite small… it only has 88 lines… but what does that means for now? :smiley:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.