Skip to content

Instantly share code, notes, and snippets.

@imajes
Created July 20, 2010 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save imajes/483404 to your computer and use it in GitHub Desktop.
Save imajes/483404 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$('.async').live('click', function() {
var current = $(this).text();
if ( current == 'show' ) {
$(this).text('hide');
} else if (current == 'hide') {
$(this).text('show');
}
$.getJSON($(this).attr('href'),
function(data) {
message = "<div class='flash notice'>" + data.message + "</div>";
$('#result').html(message);
}
);
return false;
});
});
$(document).ready(function() {
$('.search').live('change', function() {
var txt = $(this).text();
$.getJSON('/sheet_musics/search/'),
function(data) {
$('#result').html(data.result);
}
);
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment