29 lines
1.4 KiB
JavaScript
29 lines
1.4 KiB
JavaScript
$(function(){
|
|
$('.configurator-opt-change').on('change', function(e) {
|
|
$.post($(this).data('url'), $('form#buy_block').serialize(), function (data) {
|
|
$('span#our_price_display').replaceWith('<span id="our_price_display" class="price" itemprop="price" content="'+data.price+'">'+data.priceDisplay+'</span>');
|
|
}, 'json').fail(function(){});
|
|
});
|
|
$('.configurator-opt-click').on('click', function(e){
|
|
$.post($(this).data('url'), $('form#buy_block').serialize(), function (data) {
|
|
$('span#our_price_display').replaceWith('<span id="our_price_display" class="price" itemprop="price" content="'+data.price+'">'+data.priceDisplay+'</span>');
|
|
}, 'json').fail(function(){});
|
|
})
|
|
$('.configurator-opt-datepicker').datepicker({dateFormat: "dd MM yy"});
|
|
$('.configurator-opt-file').fileupload({
|
|
dataType: 'json',
|
|
done: function (e, data) {
|
|
$.each(data.result.files, function (index, file) {
|
|
// Set hidden field
|
|
$('input[name='+$(e.target).data('field')+']').val(file.name);
|
|
// Set Response
|
|
$('span#response-'+$(e.target).data('field')).text(file.name).trigger('change');
|
|
$(e.target).parent().find('span.filename').text('');
|
|
});
|
|
},
|
|
progressall: function (e, data) {
|
|
$('span#response-'+$(e.target).data('field')).text("Envoi en cours...");
|
|
var progress = parseInt(data.loaded / data.total * 100, 10);
|
|
}
|
|
}).prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');
|
|
}); |