/    Sign up×
Community /Pin to ProfileBookmark

Javascript help please

I usually program using php and I know a little javascript however I am having problems with the following:

Below is a tracking link that I need a total sale amount and a receipt number to print in. However I must use info from the header to fill the fields.

For example the header is: http://www.oursite.com/membership?total=3.50&receipt=xfda

I need the total to fill SALE_AMOUNT below and receipt to fill TRANSACTION_ID below:

<script src=”http://site.com/sale/SALE_AMOUNT/TRANSACTION_ID/”></script>

I have tried a function to pull the data from the header and it worked but then I could not print the data in the script src tag.

Any help would be appreciated.

Thanks,

Stohn

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@NedalsFeb 12.2005 — This should work for you BUT you need to get rid of the decimal point. You cannot use it in a URL name.
[size=1]
&lt;script type="text/javascript"&gt;
&lt;!--
var queryStr = location.search.replace(/?/,"");
var pairs = queryStr.split('&amp;');
var amt = pairs[0].split('=')[1];
var id = pairs[1].split('=')[1];
document.write('&lt;script src="http://site.com/sale/' +amt+ '/' +id+ '/"&gt;&lt;/script&gt;');
//--&gt;
&lt;/script&gt;
[/size]
Copy linkTweet thisAlerts:
@sicknoteFeb 14.2005 — i need to now who to lock a textarea ?
Copy linkTweet thisAlerts:
@LeeUFeb 14.2005 — You might try this:

[URL=http://www.webreference.com/js/tips/000810.html]http://www.webreference.com/js/tips/000810.html[/URL]
×

Success!

Help @stohn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...