Guest User

Untitled

a guest
May 27th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. $.fn.beer = function(settings) {
  2. settings = $.extend({ url: "/", container: "#id-of-container" });
  3. return this.change(function() {
  4. var val = $(this).val();
  5. $.post(settings.url, val, function(response) {
  6. $(settings.container).html(response);
  7. });
  8. });
  9. }
  10.  
  11. $(document).ready(function() {
  12. $('#id-of-input').beer({ url: '/url/to/post/to' });
  13. })
Add Comment
Please, Sign In to add comment