Need Help inserting variable into Javascript URL

Discussion in 'JavaScript' started by rockon, Aug 12, 2008.

  1. #1
    Hello, I am seeking some assistance for a scripting syntax I am unfamiliar with. Any experts and pros care to shed some light? Much appreciated!

    Here's the skinny...

    A credit card transaction gets processed from my payment URL. It then passes a variable called {!payment.receipt_id} from a PHP page called thanks.php and displays it on thanks.html. I am trying to insert the Receipt ID into a URL string on the resulting thank you page (thanks.html).


    Just below is what I placed in my thanks.html page:

    ----------------
    <script src="http://launch.mydomain.com/i_sale_third/100/LINE_ITEM_STRING/{$payment.receipt_id}/OPTIONAL_INFORMATION"></script>
    <noscript><IMG SRC="http://launch.mydomain.com/i_track_sale/100/LINE_ITEM_STRING/{$payment.receipt_id}/OPTIONAL_INFORMATION"></noscript>

    -----------------


    Next,

    Here's what was populated on the HTML page after CreditProcessing returned a successful transaction/receipt ID.

    <script src="http://launch.mydomain.com/i_sale_third/100/LINE_ITEM_STRING/{$payment.receipt_id}/OPTIONAL_INFORMATION"></script>
    <noscript><IMG SRC="http://launch.mydomain.com/i_track_sale/100/LINE_ITEM_STRING/1946161598/OPTIONAL_INFORMATION"></noscript>


    *** Notice that the 2nd <noscript> line DID in fact populate the Receipt_ID, but the <script> line above did not. I assume that's because the {$payment.receipt_id} variable cannot be passed into a javascript function, and probably requires correct syntax for it to be inserted inside of the <script> function.

    I don't know Javascript and I'm not a programmer, but this I have managed to logically figure out.

    If anyone can lend some insight and point me in the right direction, I would greatly appreciate it!


    -- Rock
     
    rockon, Aug 12, 2008 IP