MrFish Posted August 10, 2009 Share Posted August 10, 2009 I made a login but when you try and click the Logout text nothing happens. The onClick sends it to the ajaxLogout() function but when I change it to a simple alert() it works fine. <?echo '<a>' . $_SESSION["username"] . '</a> | Messages(<a>#</a>) | Online Friends(<a>#</a>) | <a onClick="ajaxLogout()">Logout</a>';?> Full Code ...<!-- AJAX LOGOUT --> function ajaxLogout(){ alert('dun dun duuuun!'); }</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html> <head> <title> Index</title> <link rel="stylesheet" type="text/css" href="default.css"> </head> <body> <div id="ghost"> <div id="userbar"> <div id="userbarsubwrapper"> <a>mrfish</a> | Messages(<a>#</a>) | Online Friends(<a>#</a>) | <a onClick="ajaxLogout()">Logout</a> </div> </div> <div id="wrapper"> <div id="subwrapper"> ... I took out any ajax scripts and put in a simple alert to test and make sure it wasn't the logout script that had errors. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 10, 2009 Share Posted August 10, 2009 You have your script tag before the doctype. Nothing goes before the doctype. Script tags go in either the head or the body. Other than that, if your logout function isn't working correctly then check for Javascript errors. If you're not sure what's happening post the code for the function. Link to comment Share on other sites More sharing options...
chibineku Posted August 10, 2009 Share Posted August 10, 2009 Also, I think in the instance of framing the text as an anchor, the standard way to call a function is to use the javascript pseudolink:<a href="java script:functionName()"> </a> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.