views:

78

answers:

1

Hi Guys.

In my HTML I have the following situation:

<a href='product-enquiry.php?product=SR1'>Enquire about SR1</a>

This then sends a user through to a separate page where the product ID (in this case SR1) is passed into a input field:

<input type='text' value='<?php echo $_GET['product'] ?>'>

I would prefer to use fancybox to bring up the product enquiry form in a pop up window. To do this, the JavaScript code for fancybox is:

$('.product-enquiry').attr("href", "product-enquiry.php")

How do I append a product number to the end of "product-enquiry.php: in the javascript file so that the product number changes depending on which link a user clicks on (For example, if they select the product 'SR2' - how do I pass this through?)

Hope this makes sense and any help would be great.

Thanks, Mark.

A: 

Erm, if I understand your problem correctly you (very probably) just add $('.product-enquiry').attr("href", "product-enquiry.php?product=SR1");

If you have several links to products you’ll have to bind click-events.

You’d give your product container (div) an appropriate ID you can then read in the click()-called callback function and pass into the href, which you then set for the fancybox.

Kissaki