String execution with JQuery

0

I have a link that when clicked generates a modal, this link contains an address that contains an 'id' that is dynamically generated at each new registration the link of the page and the same of the link that changes and that the address of the link contains the id at the end, the issue is that when user clicks the link that opens the modal precise that the address of the page is changed to the link address that is the same as the page that changes and only the id that is included in the end of address

Example:

Url page http://www.exemplo.com + '?id=2' or need to be included only here → ?id=2 at the end of the address because in the modal I will get this id via $_GET in PHP and also it is necessary that when changing the address automatically click again on the link to open the final modal with the address already changed my function that I did that is just below already is changing the address and running the automatic click but this doing messy: the desired execution steps would be this:

  • Step 1 user clicks the link, url is changed to link address
  • Step 2 re-run the click of the final ink click

JQuery code that I did to perform this procedure is not working as it should:

$(function() {
    $('.event').click(function() {
        // Pega o valor do link clicado
        var href1 = this.href;
        // alert(href1);
        // Sobrescreve o link atual com o novo link e redireciona para o novo link
        $(window.document.location).attr('href', href1);'
    });

    // Executa novamente o click do botão
    $(".event").trigger("click");
});
    
asked by anonymous 11.09.2016 / 15:57

0 answers