Redirect with jQuery / Javascript click

1

I have a Home page in which when I click on a menu item, redirect the other page and a click in a certain service in an "accordion / accordion" menu.

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);

Do not make cute here rs.

But that is not working. I gave alert() and by what I think it gives the command within setTimeout BEFORE going to the other page.

    
asked by anonymous 12.05.2014 / 16:24

1 answer

1

This is not possible since you can not execute the object of another page through the current page by javascript.

What I would advise would be for you to go through the URL

var index = $(this).parent().attr('index');
$(window.document.location).attr('href', 'index.php/servicos/'+index);

And in the services page in case, check if this get arrived, and if it has arrived, execute: $('.'+ (o get que passou) +' img').click()

    
12.05.2014 / 16:44