Link to home
Start Free TrialLog in
Avatar of Pedro Chagas
Pedro ChagasFlag for Portugal

asked on

Jquery - Access to the function

Hi E's, I have this code:
$("#tela_inicial").click(function(){
em_jogo = 1;

$(function(){
        $.ajax({
        type: "POST",
        url: "abertura.php",
        data: {"nj":numero_jogo, "fase":'1', "ref":ref_puzzle, "ip":ip_cliente},
        success: function(dat){
                if(dat == ""){
                    //nao faz nada
                } else {
                // redirect
                window.location=dat;
                } 
        }
        });
});

Open in new window

That snippet code shows a function that is executed when click in the div (#tela_inicial).
My issue is, I want access to that code, but in other context.
In practice, if I click in #tela_iniciar, the script execute code inside the function.
I have a part in my code where I will need access to that code, but not with the click in #tela_iniciar.
So, my question is, how I access to that function without via #tela_iniciar?

The best regards, JC
ASKER CERTIFIED SOLUTION
Avatar of soupBoy
soupBoy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pedro Chagas

ASKER

Hi @soupBoy, what's in the box code does not matter, is just for this example, in the future can be lots of kinds of code.
What matter here, is the access to the same function, but in different way. For my case not matter what is inside the function.
It may not have solution.

~JC