Skip to content Skip to sidebar Skip to footer

Get Input Value From Database Based On Previous Input

I have a salary adding form, where I have to manually type in the rate for the morning and night shifts for every company. Every company have different rates. I want to make it as

Solution 1:

You must used AJAX call to request the datas from database. But, you must have too a backend language (ex: PHP, Python...) because it's him who will retrieve the datas from database. Example with jQuery:

submitForm = function(url, element) {
    const dataForm = element.serializeArray();
    let data = {'id': dataForm[0]}

    $.ajax({
        method:'POST',
        url: url, // Your url to send the datas (the id in your view for example) at your backend
        data: data,
    }).then(response () {
        console.log(response.rate)
    })
}

I hope so help you.


Post a Comment for "Get Input Value From Database Based On Previous Input"