Hi guys,
I've got a problem with Request HTML on a website I'm developping and
I need some help. I've gota a div that is updated with Request.HTML.
The div is updated when I click on a series of links. It's sort of a
gallery. However, if I click on a link and right after click again on
a second link before the first content is loaded, both content are
loaded together. Instead, I want only one content each time. Is there
a way to prevent that? I mean, like to prevent a new request while
there's one already running? Or to stop a second request while there's
one already running?
Here's my code:
var menuSabores = $$('a.mini');
menuSabores.each(function(element) {
element.addEvent('click', function(event) {
event.stop();
var req = new Request.HTML({
url: element.get('href'),
method: 'get',
update: embalagem,
onFailure: function() {
embalagem.set('text', 'Erro ao carregar o
produto');
}
}).send();
$$('a.mini').removeClass('ativa');
element.addClass('ativa');
});
});
If someone would like to see it in action, please, let me know and
I'll send the link privately. I can't divulge it here.
Thanks in advance.
Cátia