Guest User

Untitled

a guest
May 27th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. $("#clubAutoComplete").on("input", function(e){
  2. $("div.clubResults").show();
  3. $("div.clubResults").empty();
  4. var val = $(this).val();
  5. $.ajax({
  6. type: "get",
  7. dataType: "JSON",
  8. data: '',
  9. url: "example.com?input=" + val,
  10. success: function(data){
  11. $.each(data, function (index, element) {
  12. $("div.clubResults").append('<p class="clubResults" id="' + element.clubId + '">' + element.clubName + '</p>');
  13. });
  14. }
  15. });
  16. });
  17.  
  18. $(document).on("click", "p.clubResults", function(){
  19. var clubId = $(this).attr("id");
  20. var clubName = $(this).text();
  21. alert("test");
  22. });
Add Comment
Please, Sign In to add comment