application.js-emptyquery.patch

Jongwook Choi, 2012-09-22 19:00

Download (1.13 KB)

View differences:

public/javascripts/application.js
478 478
      var val = $this.val();
479 479
      if ($this.attr('data-value-was') != val){
480 480
        $this.attr('data-value-was', val);
481
        if (val != '') {
482
          $.ajax({
483
            url: url,
484
            type: 'get',
485
            data: {q: $this.val()},
486
            success: function(data){ $('#'+targetId).html(data); },
487
            beforeSend: function(){ $this.addClass('ajax-loading'); },
488
            complete: function(){ $this.removeClass('ajax-loading'); }
489
          });
490
        }
481
        $.ajax({
482
          url: url,
483
          type: 'get',
484
          data: {q: $this.val()},
485
          success: function(data){ $('#'+targetId).html(data); },
486
          beforeSend: function(){ $this.addClass('ajax-loading'); },
487
          complete: function(){ $this.removeClass('ajax-loading'); }
488
        });
491 489
      }
492 490
    };
493 491
    var reset = function() {