I want to retrieve the input value which is an array using AJAX.
<td>
<label for=""><?php _e( 'State' ); ?></label>
<input type="text" name="state_to[<?php echo $country_id ?>][]" class=" state_selection" placeholder="State name">
</td>
$('.location-wrapper').on('change', '.state_selection', function() {
var country = $('#country_selection').val();
var self = $(this),
data = {
//state_id : self.find(':selected').val(),
state_id : $('input[name="state_to[country][]"]').val(),
country_id: $('#country_selection').val(),
action : 'select_zip_by_state_country'
};
});
I am able to retrieve correct value fpr country but not for state. Please can someone help me with this?