How to pass a value to a jquery dialog from oscommerce

How to pass a value to a jquery dialog from oscommerce

Hi,

I am trying to pass a product name from my oscommerce store product listing into a dialog modal.

The code I have so far which has been put together by a friend as I do not fully understand jquery (yet!)

  1. $prod_list_contents .= '<td width="4%" align="center"><input class="call_hidden" type="hidden" value="' . TEXT_GET_PRICE_PRODUCT . '&nbsp;' . $listing['products_name'] . '" /> <a href="' . tep_href_link(FILENAME_CONTACT_US_POPUP) . '" target="_blank" class="a_call">' . TEXT_CALL_FOR_PRICE . '</a></td><td width="1%">&nbsp;</td>'
and the script:

  1. <div id="contactus" title="<?php echo TEXT_GET_PRICE_PRODUCT . '&nbsp;' . $listing['products_name']; ?>">
        <?php include(FILENAME_CONTACT_US_POPUP); ?>
      </div>

    <script type="text/javascript">
    $(function(){
    $(".a_call").click(function(){
    var title = $(this).parent().children('.call_hidden').val();
    $("#contactus").attr("title", 'title').dialog("open");
    return false;
    });

    $('#contactus').dialog({
      autoOpen: false,
      width: 500,
      modal:true
    });
    });
    </script>

















The dialog opens and contains a contact form but the title of the box should contain the product name, see image.



Any help on solving this problem would be much appreciated.

Thanks

Mark