Link change with JavaScript or PHP

0

I'm having a problem with a button where I need to change the link with javascript or php.

Come on!

My platform generates an automated form, but I do not have access to the source code. The form collects name and email and sends it to the platform, which is why the form is ready. But when collecting the data, it continues on the same page, I need to redirect to another page the user clicks on the button and the button also continues with his functionality to register the data in the platform, however I do not have the source code as stated above. / p>

I can see the id's, class, name and everything else by "inspecting" the browser, I would like to know if there is any way to redirect the page with js or php knowing that I know the attributes above.

<div class="pages">
   <cxc.newsletter/>
</div>

This div is to call the form from the platform already ready. When it is displayed in the browser, it shows the form with the fields to fill, and these fields have their id, name, class which I also use to stylize the inputs and button.

    
asked by anonymous 17.10.2017 / 00:41

1 answer

0

Create a addEventListener for the button, and when it is clicked, it will start a setInterval that will check if the id of div of commit exists on the page. When it exists, it will redirect to the page in location.href :

<script>
window.onload = function(){
    document.getElementsByClassName("dados")[0].addEventListener("click", function(){
        temporizador = setInterval(function(){
            if(document.getElementById("id_da_div_de_confirmação")){
                clearInterval(temporizador);
                location.href = "página_para_aonde_quer_ir.html";
            }
        }, 10);
    });
}
</script>
    
17.10.2017 / 01:52