Th3Boss Posted March 23, 2013 Share Posted March 23, 2013 Never used javascript before so trying to figure this out. Page 1: <?php $DataTypeID="599"; include("Page2.php"); ?> Page 2: <head> <script type="text/javascript"> $(function() { $('.Fitting .Info').on('click', showItemInfo); }); function showItemInfo() { var typeID = $(this).attr('data-typeid'); CCPEVE.showInfo(typeID); } </script> </head> <body> <div class="Fitting"> <div class="Info" data-typeid == <?$DataTypeID?> title="View">INFO</div> </div> </body> Pretty sure this is wrong data-typeid == <?$DataTypeID?> How do I get this to work? Quote Link to comment https://forums.phpfreaks.com/topic/276072-javascript-help/ Share on other sites More sharing options...
.josh Posted March 24, 2013 Share Posted March 24, 2013 How do I get this to work? well you can start by explaining what it is you are tying to accomplish... Quote Link to comment https://forums.phpfreaks.com/topic/276072-javascript-help/#findComment-1420615 Share on other sites More sharing options...
requinix Posted March 24, 2013 Share Posted March 24, 2013 Pretty sure this is wrong data-typeid == <?$DataTypeID?> You bet. Compare that withclass="Fitting" class="Info" title="View"See a pattern in there? Quote Link to comment https://forums.phpfreaks.com/topic/276072-javascript-help/#findComment-1420617 Share on other sites More sharing options...
Th3Boss Posted March 24, 2013 Author Share Posted March 24, 2013 well you can start by explaining what it is you are tying to accomplish... On click of class="Info" it uses $DataTypeID for data-typeid from page 1 and does showItemInfo using that data form data-typeid as typeID. Quote Link to comment https://forums.phpfreaks.com/topic/276072-javascript-help/#findComment-1420621 Share on other sites More sharing options...
Th3Boss Posted March 24, 2013 Author Share Posted March 24, 2013 You bet. Compare that with class="Fitting" class="Info" title="View"See a pattern in there? I see they are all ="" Quote Link to comment https://forums.phpfreaks.com/topic/276072-javascript-help/#findComment-1420624 Share on other sites More sharing options...
haku Posted March 24, 2013 Share Posted March 24, 2013 On click of class="Info" it uses $DataTypeID for data-typeid from page 1 and does showItemInfo using that data form data-typeid as typeID. I'm not sure if you thought that was a good explanation of what you are trying to do, but let me assure you, it wasn't. Quote Link to comment https://forums.phpfreaks.com/topic/276072-javascript-help/#findComment-1420642 Share on other sites More sharing options...
Solution Th3Boss Posted March 24, 2013 Author Solution Share Posted March 24, 2013 Figured it out finally. Quote Link to comment https://forums.phpfreaks.com/topic/276072-javascript-help/#findComment-1420652 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.