Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying pass a html element id (from a td actually) through JQuery to a php page. The JQuery function i'm using is:
JavaScript
$(document).ready(function(){
               $("td").click(function () {
               alert($(this).attr('id'));
               $.post("index.php?p=lesson", { id: $(this).attr('id') }, function (response) {
                   alert(response);
               });
           });
         })


and the call in the php page:

PHP
$lessonPath=$_POST['id'];


but the variable i'm passing the the value in php page doesnt get a value at all.
Any ideas?
Posted
Comments
Graham Breach 23-Jan-14 14:30pm    
I've tried out your jQuery code on a test page, and it works for me - the table cell ID is being passed into the PHP file in the POST data.
pedrag 23-Jan-14 16:46pm    
yeah, this is what i do too. Have you add anything different;
Kornfeld Eliyahu Peter 23-Jan-14 17:42pm    
It's unclear what is your problem. Your code works just fine...Please elaborate...
pedrag 24-Jan-14 5:51am    
i think tha the problem is the link i'm sending the value to. Do you thing it should be in another format?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900