Pergunta

No chrome função, mas no IE10 erro de retorno para o nome da variável na função, como eu posso ter acesso a essa variável da função?

  $('.kpit').on('click', function() {        
        var url = $(this).attr('id');
        var name = $(this).attr('href');
        $('.kpi').html('');
        $.post(url, {idKpi: id}, function(result) {
            $(name).html(result);
        });
  });
Foi útil?

Solução

Tente:

 $('.kpit').on('click', function() {        
        var name = $(this).attr('id');
        var element = $(this); //Removed the .attr('href'), as that would store the URL, not the element.

        $('.kpi').html('');
        $.post(name, {idKpi: id}, function(result) {

        $(element).attr('href',result); //Set the HREF by using .attr, not .html
        });
  });

Ver Definição de atributo href, em tempo de execução

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top