Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#clubAutoComplete").on("input", function(e){
- $("div.clubResults").show();
- $("div.clubResults").empty();
- var val = $(this).val();
- $.ajax({
- type: "get",
- dataType: "JSON",
- data: '',
- url: "example.com?input=" + val,
- success: function(data){
- $.each(data, function (index, element) {
- $("div.clubResults").append('<p class="clubResults" id="' + element.clubId + '">' + element.clubName + '</p>');
- });
- }
- });
- });
- $(document).on("click", "p.clubResults", function(){
- var clubId = $(this).attr("id");
- var clubName = $(this).text();
- alert("test");
- });
Add Comment
Please, Sign In to add comment