Re: Ajax
| From: | Karl DeSaulniers | Date: | Thu, 21 Feb 2013 04:40:13 +0000 |
| Subject: | Re: Ajax | ||
| References: | 1 2 3 4 5 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-48691@lists.php.net to get a copy of this message | ||
On Feb 20, 2013, at 10:13 PM, Ethan Rosenberg, PhD wrote:
On 02/20/2013 10:49 PM, Karl DeSaulniers wrote:FYI this is redundent. for($i=0; $i<10; $i++) {I think you need to set it here. <script type="text/javascript"> $(document).ready(function(){============= Karl -$("#e1").dblclick(function(e) { var id = $(this).attr('id'); ///This was missing $.post("testClickcallback.php", {"custnum":cusn}, function getCustNo(id) { cno = 'cust'+id; cnm = "name"+id; cname = document.getElementById(cnm).innerHTML; cnum = document.getElementById(cno).innerHTML; alert("For customer "+cname+" the number is "+cnum); return; } // alert("subval");//alert(subval); ,"html"); }); }); </script> Best, Karl<snip>var id = $(this).attr('id'); ///This was missing alert(id); // alert= undefinedEthan
$k = $i ; //this is not needed.
$results .= "<tr><td id='name$i' >$names[$k] </td><td id='nums$k'>$nums[$k]</td></tr>";
}
You can just do.
for($i=0; $i<10; $i++)
{
$results .= "<tr><td id='name$i' >$names[$i] </td><td id='nums$i'>$nums[$i]</td></tr>";} unless you need $k = $i +1; on the javascript, I think the id is equaling 0 thats why $('#e1') is not working. change to $('#e0') just for giggles. or try the &k = $i + 1 HTH, Karl DeSaulniers Design Drumm http://designdrumm.com