Created
February 25, 2013 18:34
-
-
Save Mizpah/5032106 to your computer and use it in GitHub Desktop.
Here what I started with (application.js / index.js.erb), and the subsequent attempts.
I also tried an entirely new game_classes_coffee.js. note the railscast version of the file (application.js) reads: ).live("click", -- have changed this to on mylsef.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$("#game_classes th a, #game_classes .pagination a").on("click", function() { | |
$.getScript(this.href); | |
return false; | |
}); | |
$("#game_classes_search input").keyup(function() { | |
$.get($("#game_classes_search").attr("action"), $("#game_classes_search").serialize(), null, "script"); | |
return false; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$(document).on('click tap', '#game_classes th a, #game_classes .pagination a', () -> | |
$.getScript(this.href); | |
return false; | |
}); | |
$("#products_search input").keyup(function() { | |
$.get($("#game_classes_search").attr("action"), $("#game_classes_search").serialize(), null, "script"); | |
return false; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery -> | |
# Ajax sorting and pagination on click - taken from a railscase comment and adapted. | |
$('#game_classes td.sortable a, #game_classes .pagination a').live('click', -> | |
$.getScript(this.href) | |
false | |
) | |
# Ajax search on submit | |
$('#game_classes_search').submit( -> | |
$.get(this.action, $(this).serialize(), null, 'script') | |
false | |
) | |
# Ajax search on keyup | |
$('#game_classes_search input').keyup( -> | |
$.get($("#game_classes_search").attr("action"), $("#game_classes_search").serialize(), null, 'script') | |
false | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#game_classes").html("<%= escape_javascript(render("game_class")) %>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment