Na verdade estou usando a janela modal do site maujor, onde ao clicar no link acima, abrirá uma janela modal com o ID do produto, porém não estou conseguindo. Tentei colocar dessa forma:
$(document).ready(function() {
$('a[name=modal]').click(function(e) {
e.preventDefault();
var id = $(this).attr('href');
//////// COLOQUEI ISSO AQUI //////////////////
$("#nomeUsuario").click(function(event){
event.preventDefault();
var nomeUsuario = $(this).attr('id');
$.get('index.php', {}, function(response){
alert(nomeUsuario);
$("#lista").html(response).show();
})
});
//////////////////////////////////////////
var maskHeight = $(document).height();
var maskWidth = $(window).width();
$('#mask').css({'width':maskWidth,'height':maskHeight});
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
$(id).fadeIn(2000);
});
$('.window .close').click(function (e) {
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});
});
Pergunta
MTavares
Colegas. Estou com mais uma dúvida. QUero pegar uma variável de um link, jogar para o Jquery e pegar com php. Mais ou menos assim.
Na verdade estou usando a janela modal do site maujor, onde ao clicar no link acima, abrirá uma janela modal com o ID do produto, porém não estou conseguindo. Tentei colocar dessa forma:
$(document).ready(function() { $('a[name=modal]').click(function(e) { e.preventDefault(); var id = $(this).attr('href'); //////// COLOQUEI ISSO AQUI ////////////////// $("#nomeUsuario").click(function(event){ event.preventDefault(); var nomeUsuario = $(this).attr('id'); $.get('index.php', {}, function(response){ alert(nomeUsuario); $("#lista").html(response).show(); }) }); ////////////////////////////////////////// var maskHeight = $(document).height(); var maskWidth = $(window).width(); $('#mask').css({'width':maskWidth,'height':maskHeight}); $('#mask').fadeIn(1000); $('#mask').fadeTo("slow",0.8); //Get the window height and width var winH = $(window).height(); var winW = $(window).width(); $(id).css('top', winH/2-$(id).height()/2); $(id).css('left', winW/2-$(id).width()/2); $(id).fadeIn(2000); }); $('.window .close').click(function (e) { e.preventDefault(); $('#mask').hide(); $('.window').hide(); }); $('#mask').click(function () { $(this).hide(); $('.window').hide(); }); });E tentando pegar assim:
Só que não aparece....
obrigado
Link 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.