Site icon Hip-Hop Website Design and Development

Tips on how to retailer information from a number of types utilizing ajax and php

I’ve customized put up loop, and for every product I’ve type.
I might wish to retailer information in array for every click on submit button in every product.
E.x.
Product A with Type and a few values (value,amount) click on submit, and I’ve array with values in my perform.
Product B with Type and a few values (value,amount) click on submit, and I’ve array with values from values from BV product in my perform, however override previous values from product A.

ajax:

jQuery(perform ($) {
    $(doc).prepared(perform () {


        jQuery("form[name='form_add_to_cart']").on('submit', perform (e) {
            e.preventDefault();
            jQuery.ajax({
                url: my_ajax_object.ajax_url,
                methodology: 'put up',
                information: $(this).serialize(),
                success: perform (response) {
                    $('.response').html(response);
                    //console.log(formData);
                },
                fail: perform (err) {
                    alert("There was an error: " + err);
                }
            });
            return false;
        });
    });
});

capabilities.php

add_action('wp_ajax_send_form', 'send_form');
add_action('wp_ajax_nopriv_send_form', 'send_form');
perform send_form()
{
    $data_array();
    if (isset($_POST['action'])) {
        $information = $_POST;
    }

    return $information;

}

Do not know methods to retailer values from every type…
entire type : https://pastebin.com/YJXTjGjJ