views:

31

answers:

0
$('#request_song').autocomplete({
  serviceUrl: '<%= ajax_path("trackName") %>',
  minChars:1,
  width: 300,
  delimiter: /(,|;)\s*/,
  deferRequestBy: 0, //miliseconds
  params: { artists: 'Yes' },
onSelect: function(value, data){
       artist = $('#request_artist').val(); //this will return "The Killers"
   //make an ajax request to "/events/artist"


},

I am trying to make an ajax request inside the onSelect function is there a better way and if not what would be the syntax for calling "/events/The killers" and what about the string replace in that i need. Is there a clean way of doing this