Jump to content

Why isn't this alert() working?


nerotic

Recommended Posts

 

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?

Link to comment
https://forums.phpfreaks.com/topic/206720-why-isnt-this-alert-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.