What I have here works great. But now my question is how would I make sure that before making an ajax call I have the data available in a client side model and I would look into that. If I dont find it in there then I make the call. How should I approach it?
FIND
jQuery(function(){
jQuery('.findInStore').live('click', function(){
var postalCode = jQuery('#postalCode').val();
var dataModel;
if(postalCode != ''){
jQuery.ajax({
type: "POST",
url: "server side url",
data: {
postalCodeValue: postalCode
}
}).done(function (data) {
dataModel = jQuery.parseJSON(data);
console.log(dataModel);
jQuery('.error').text('');
});
}else{
jQuery('.error').text('empty');
}
});
});