Jump to content


Photo

Javascript Help


Best Answer Th3Boss, 24 March 2013 - 12:29 AM

Figured it out finally.

Go to the full post


  • Please log in to reply
6 replies to this topic

#1 Th3Boss

Th3Boss

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts

Posted 23 March 2013 - 06:54 PM

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?



#2 .josh

.josh

    .josh

  • Administrators
  • 14,808 posts

Posted 23 March 2013 - 07:02 PM

How do I get this to work?

 

well you can start by explaining what it is you are tying to accomplish...



Did I help you? Feeling generous? Donate to me! || Donate to phpfreaks!
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 requinix

requinix

    Hopeless Member

  • Moderators
  • 5,913 posts
  • LocationWA

Posted 23 March 2013 - 07:07 PM

Pretty sure this is wrong

data-typeid == <?$DataTypeID?>
 


You bet. Compare that with
class="Fitting"
class="Info"
title="View"
See a pattern in there?

#4 Th3Boss

Th3Boss

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts

Posted 23 March 2013 - 07:43 PM

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.



#5 Th3Boss

Th3Boss

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts

Posted 23 March 2013 - 07:44 PM

You bet. Compare that with

class="Fitting"
class="Info"
title="View"
See a pattern in there?

 

 

I see they are all =""



#6 haku

haku

    Advanced Member

  • Staff Alumni
  • 6,172 posts

Posted 23 March 2013 - 09:28 PM

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.



#7 Th3Boss

Th3Boss

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts

Posted 24 March 2013 - 12:29 AM   Best Answer

Figured it out finally.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com