1
I have a home page where when clicking on a menu item, redirect to another page and a click
in a given service in a "accordion/accordion".
I have something like this:
var index = $(this).parent().attr('index');
$(window.document.location).attr('href', 'index.php/servicos');
setTimeout(function(){
$('.'+ index +' img').click()
}, 1000);
Don’t make it cute here rs.
But that’s not working. I gave a alert()
and it seems to me that he gives the command inside the setTimeout
BEFORE GOING TO ANOTHER PAGE.
Yes, it makes sense to run it before going to another page (as far as I know, it is impossible to execute a code on one page, redirect it to another and the code affects the next page, I may be wrong). Ideally, you pass on the information of which item was clicked to the next page. Passed on as cookie, GET, POST, Session Storage, Local Storage or in the server/client logic itself on the page in question.
– Wakim
You are using an iframe?
– Sergio