Dialog annonce : javascript redesign

This commit is contained in:
Michael RICOIS 2017-02-14 11:37:32 +01:00
parent 7f43461f7d
commit 4a1ea34d41

View File

@ -53,9 +53,9 @@ Attention à bien vérifier ce qui est fait !
<label>Type d'événement</label><br/>
<select name="even[]" multiple="multiple" size="10" style="width:600px;">
<option value="">-</option>
<?php foreach ($this->evens as $code => $lib):?>
<?php foreach ($this->evens as $code => $lib) {?>
<option value="<?=$code?>"><?=$lib?></option>
<?php endforeach;?>
<?php }?>
</select>
</form>
<br/>
@ -87,20 +87,13 @@ $('select[name="even[]"]').change(function(){
<script type="text/javascript" src="/libs/form/jquery.form.min.js"></script>
<script>
$('form#saisie').submit(function(){
event.preventDefault(); // Prevent the form from submitting via the browser
$('form#saisie').submit(function(e){
e.preventDefault();
var form = $(this);
$.ajax({
target: '#result',
type: "POST",
url: form.attr('action'),
data: form.serialize()
}).success(function(data) {
$.post(form.attr('action'), form.serialize(), function(data){
$('#result').html(data);
// Optionally alert the user of success here...
}).error(function(data) {
$('#result').html('Copie impossible');
// Optionally alert the user of an error here...
}).fail(function(data) {
$('#result').html('Une erreur est survenue !');
});
return false;
});