nerotic Posted July 4, 2010 Share Posted July 4, 2010 Here's my $_SESSION start: <?php session_start(); $section = $_SESSION["nav"]; ?> My js: <script language="JavaScript" type="text/javascript"> $(document).ready(function() { $("div.tabs").tabs(".images > div", { // enable "cross-fading" effect effect: 'fade', fadeInSpeed: 600, fadeOutSpeed: 1000, // start from the beginning after the last tab rotate: false // use the slideshow plugin. It accepts its own configuration }).slideshow({autoplay: false, interval:5000}); $("a.lnav").onclick(function() { // Get the ID of the link var src = $(this).attr("id"); alert(id); // Send Ajax request to backend.php, with src set as "id in the POST data $.post("/backend.php", {"id": src}); }); }); </script> Here's backend.php: <?php // do any authentication first, then add POST variable to session $_SESSION['nav'] = $_POST['id']; ?> Why can't I get the alert(src) to work? Quote Link to comment https://forums.phpfreaks.com/topic/206720-why-isnt-this-alert-working/ Share on other sites More sharing options...
RichardRotterdam Posted July 5, 2010 Share Posted July 5, 2010 My quess is that your not using the jquery click event try to change the following : $("a.lnav").onclick(function() { into $("a.lnav").click(function() { Quote Link to comment https://forums.phpfreaks.com/topic/206720-why-isnt-this-alert-working/#findComment-1081239 Share on other sites More sharing options...
trq Posted July 5, 2010 Share Posted July 5, 2010 Also.... Why can't I get the alert(src) to work? Because your code says: alert(id); Quote Link to comment https://forums.phpfreaks.com/topic/206720-why-isnt-this-alert-working/#findComment-1081262 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.