I am generating some select inputs dynamically, and it follows this structure
<select id="OrderType_orderItem_0_product" name="OrderType[orderItem][0][product]" class="form-control">,
<select id="OrderType_orderItem_1_product" name="OrderType[orderItem][1][product]" class="form-control">
and so on.
I need to do a ajax post on .change on every select generated, how can I do that?
Right now I have this, but it obviously just work for the first select of id 0:
$(document).ready(function () {
$('[name="OrderType[orderItem][0][product]"]').change(function(){
var val = $(this).val();
$.ajax({
type: "POST",
url: "myurl" + val,
success: function(data) {
}
});
return false;
});