Welcome Guest, Not a member yet? Register   Sign In
Calling method function from Javascript/AJAX
#7

[eluser]Fribos[/eluser]
Hi, me again.
What about if i need to execute a function for session destroy when the user leaves?
I'm codding something like this:

On my controller
Code:
function destruir_sesion(){
        //destruyo sesion
        $this->session->sess_destroy();
    }

On my <head> view
Code:
function destruir_sesion(){
       if (document.location.href=='xxxxxxxxxxxx/chatfinal') {
            $.ajax({
              type: "POST",
              url: "xxxxxxxxxxxx/chatfinal/destruir_sesion",
              success: function (result) {
              }
            });
       }
    }

On my view body div
Code:
onunload="destruir_sesion()"

I cant understand AJAX sintax, so if u can help me again i'll thank you again.
Where can i find a good ajax tutorial for begginers ?
Thanks


Messages In This Thread
Calling method function from Javascript/AJAX - by El Forum - 11-25-2010, 03:08 PM
Calling method function from Javascript/AJAX - by El Forum - 11-25-2010, 03:11 PM
Calling method function from Javascript/AJAX - by El Forum - 11-25-2010, 04:02 PM
Calling method function from Javascript/AJAX - by El Forum - 11-25-2010, 04:18 PM
Calling method function from Javascript/AJAX - by El Forum - 11-25-2010, 04:51 PM
Calling method function from Javascript/AJAX - by El Forum - 11-25-2010, 09:20 PM
Calling method function from Javascript/AJAX - by El Forum - 11-25-2010, 10:41 PM
Calling method function from Javascript/AJAX - by El Forum - 11-26-2010, 03:35 PM
Calling method function from Javascript/AJAX - by El Forum - 11-26-2010, 08:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB