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 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| $('#sendnews').on('click', function(e)
{
var xhr = $.ajax({
url : window.location.pathname,
type : 'POST',
data : 'n=' + $("#nom").val() +
'&p=' + $("#prenom").val() +
'&m=' + $("#courriel").val()+
'&a=' + 'news',
dataType : 'json',
cache: false,
success : function(data)
{
var message = "";
$.each( data, function( key, value )
{
console.log(key);
if (key != '_ERROR_'){
message = message + '- ' + value + '<br />';
}
});
if ((data._ERROR_ == '2')||(data._ERROR_ == '1'))
{
$('#error').hide(1000);
$('#reussite').show('slow');
$('.messagedisplay').html(message);
return false;
}
if (data._ERROR_ == '0')
{
$('#reussite').hide(1000);
$('#error').show('slow');
$('.messagedisplay').html(message);
return false;
}
},
error : function(msg)
{
return false;
}
});
return false;
}); |
Partager