1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
function formulaire_ajax(type, donne, showError){
$.ajax({
type:"GET",
url: "/ajax/checkForm.do",
data: "type="+type+"&valeur="+donne,
dataType:"xml",
success: function(dat) {
var erreur = '';
$(dat).find("description").each(function(){
erreur += $(this).text();
});
if(erreur.length) showError(erreur);
},
error: function(){
alert('fonction ajax failed');
}
});
}
function chek_field() {
$("input[class^=smartfield]").change(function(){
s = this.getAttribute("class");
s = s.substr(11);
var me = $(this);
formulaire_ajax(s, this.value, function(erreur) {
me.after($('<div></div>')
.css({ float: 'left', width: '300px', height: '10px', color: 'red' })
.attr('id', "erreur_"+type)
.html(erreur);
);
});
})
} |
Partager