$(document).ready(function() {
$('#change_button')
.livequery('click', function() {
var form_data = {
pickup_date: $('#pickup_date').val(),
pickup_hour: $('#pickup_hour').val(),
pickup_minutes: $('#pickup_minutes').val(),
dropoff_date: $('#dropoff_date').val(),
dropoff_hour: $('#dropoff_hour').val(),
dropoff_minutes: $('#dropoff_minutes').val(),
type_of_cart: $('#cart_dropdown').val(),
ajax: '1'
};
$.ajax({
url: "<?php echo site_url('reservations/ajax_change'); ?>",
dataType: 'html',
type: 'POST',
data: form_data,
success: function(msg) {
$('#cart_types').html(msg);
}
});
return false;
});
<div class="cart_types" <?php if(!empty($length_error['dates'])) {echo 'style="display: none"';} ?> id="cart_types">
<h4>Please select a type of cart - UPDATED!</h4>
<table>
<tr>
<td style="text-align: center;font-weight: bold;">
Type of Cart
</td>
<td style="text-align: center;font-weight: bold;">
Picture
</td>
<td style="text-align: center;font-weight: bold;width: 35%;">
Description
</td>
<td style="text-align: center;font-weight: bold;">
Price
</td>
</tr>
<tr>
<td><div class="cart_dropdown">
<?php echo form_dropdown('types', $available_cart_types, $types, 'id="cart_dropdown"'); ?>
</div>
</td>
<td>
<img src="<?php echo base_url() . $type_info['picture_url']; ?>" width="216" height="144" />
</td>
<td>
<?php echo $type_info['description']; ?>
</td>
<td style="text-align: center;font-weight: bold;">
$<?php echo $type_info['price']; ?>
</td>
</tr>
</table>
</div>