Skip to content

Instantly share code, notes, and snippets.

@bondarolik
Created August 30, 2012 00:10
Show Gist options
  • Save bondarolik/3520804 to your computer and use it in GitHub Desktop.
Save bondarolik/3520804 to your computer and use it in GitHub Desktop.
Простая jquery функция для ajax запросов
function sendFeedback() {
$.post('url_to_post.php',
$('#feedbackForm').serialize(), function(data) {
var datamsg = data.split('!');
$('#message-area').hide();
if (datamsg[0] != 'Ошибка') {
// messages
$('#message-area').removeClass('error');
$('#message-area').addClass('success').show('slow');
} else {
$('#message-area').removeClass('success');
$('#message-area').addClass('error').show('slow');
}
$('#message-area').html(data).show('slow');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment