Olá amigos, estou desenvolvendo um projeto em ajax e estou tendo algumas dificuldades em um pequeno detalhe.
Como dentro da div de carregamento os links não funcionavam, eu usei a função .live do jquery, os links funcionaram tranquilamente a partir do .live mas aquele texto de mensagem "carregando..." que aparece e some, parou de funcionar, alguém sabe como posso arrumar este JS?
Pergunta
Johnbsb
Olá amigos, estou desenvolvendo um projeto em ajax e estou tendo algumas dificuldades em um pequeno detalhe.
Como dentro da div de carregamento os links não funcionavam, eu usei a função .live do jquery, os links funcionaram tranquilamente a partir do .live mas aquele texto de mensagem "carregando..." que aparece e some, parou de funcionar, alguém sabe como posso arrumar este JS?
Se alguém der uma luz fico muito agradecido!
/ $.fn.betterLoader = function(settings) { var defaults = { loading: "#mainContent", fire: ".menu", message: "Carregando...", target: "#mainContent", url: "teste.php" } settings = $.extend(defaults, settings); $this = $(this); /* * * Hide the loading content * */ if(settings.loading != settings.target) $("" + settings.loading + "").hide(); else $("" + settings.loading + "").show(); /* * * Show initial content, like body onload's attribute * */ $.get("" + settings.url + "", {}, function(data){$("" + settings.target + "").empty().html(data);}); /* * * Click function * */ $("" + settings.fire + "").live('click', function() { /* * * Ajax Start: Shows loading message and hide the target element * */ $("" + settings.loading + "").live('ajaxStart', function() { $(this).html("" + settings.message + ""); $("" + settings.target + "").hide(); }); /* * * Ajax Stop: Hide loading message and shows the target element * */ $("" + settings.loading + "").live('ajaxStop', function() { $(this).hide(); $("" + settings.target + "").show(); }); $.get("" + $(this).attr("rel") + "", {}, function(data){$("" + settings.target + "").empty().html(data);}); $.get("" + $(this).attr("action") + "", {}, function(data){$("" + settings.target + "").empty().html(data);}); $.get("" + $(this).attr("onclick") + "", {}, function(data){$("" + settings.target + "").empty().html(data);}); $.get("" + $(this).attr("href") + "", {}, function(data){$("" + settings.target + "").empty().html(data);}); }); return $this; }A parte que estou tendo problemas é esta* Click function * */ $("" + settings.fire + "").live('click', function() { /* * * Ajax Start: Shows loading message and hide the target element * */ $("" + settings.loading + "").live('ajaxStart', function() { $(this).html("" + settings.message + ""); $("" + settings.target + "").hide(); }); /* * * Ajax Stop: Hide loading message and shows the target element * */ $("" + settings.loading + "").live('ajaxStop', function() { $(this).hide(); $("" + settings.target + "").show(); });Os links abrem em void(0)
<td height="26" class="verdana_menu"><a href="java script: void(0)" class="menu" rel="PCI_cad_cliente.php?url=<?=$url;?>">Cadastrar</a><img src="img/icone.png" width="20" height="20" align="absmiddle" /></td>
Editado por JohnbsbLink para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.