Zubrag.com
October 20, 2019, 01:33:12 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: call php file from within javascript  (Read 7079 times)
glenntamis
Newbie
*
Posts: 3


« on: May 01, 2010, 06:13:12 AM »

Hi..

Can someone please help me with this:

<script type="text/javascript">
window.onbeforeunload = function (evt) {
if (typeof evt == 'undefined') {
evt = window.event;
}
if (evt) {
<a href="http://www.1stacademy.net/hello.php">
}
return;
}
</script>

I have inserted the code above into a html page so the javascript gets called when the user leaves my web page. what I want to be able to do is execute the file "hello.php" when someone leaves the page. Can anyone tell me what I would replace the line <a href="http://www.1stacademy.net/hello.php" with to do this?

Thanks
Derek

Logged

zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #1 on: May 04, 2010, 03:04:34 AM »

replace with
window.location="http://www.example.com";
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC