Skip to content

Instantly share code, notes, and snippets.

@k0001
Created November 2, 2010 16:51
Show Gist options
  • Save k0001/659924 to your computer and use it in GitHub Desktop.
Save k0001/659924 to your computer and use it in GitHub Desktop.
$.ajax({
method: 'GET',
url: '/search.json',
data: 'q=' + escape(_mq_input.val()),
traditional: true,
dataType: 'json', // response's
complete: function(xhr, status) {
if (xhr.getResponseHeader('content-type') || '' == 'application/json')
var data = JSON.parse(xhr.responseText);
if ((status == 'success' || status == 'notmodified') && data['status'] == 'OK') {
search_status.text('Procesando...');
Voton.Votos.load(data['payload']['votes']);
} else {
search_status.text('Something went wrong! Please try again later. ')
.append($('<em>').text(data['info']));
console.error(status, data['status'], data['info']);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment