I am trying to do a SIMPLE ajax request when the user changes a select
element.
Everything is done via jquery .ajax. What currently happens(and works in everything except ie), is: the ajax loads a .html file, searches through it for the value submitted by the select
element and replaces the information in .results
what the selected element. Here is the code snippet. I think I've included everything relevant.
var results = $('.results');
var selector = $('.location-selector');
selector.change(function() {
var selected = selector.val();
var dealers = $('.results .dealer');
$.ajax({
type: 'GET',
url: 'dealers.html',
success: function(data) {
var test = '.' + selected;
var search = $(data).filter(test);
results.animate({
opacity: '0'
},
500, function() {
results.empty().append(search).animate({
opacity: '1'
},
500).show();
$('.results p').linkify({
target: "_blank"
});
console.log('done');
});
},
dataType: "text"
});
});
I can't for the life of me figure this out. I even see the 'done' message in the console. I appreciate any help anyone can provide. Thank you!