Hello i have a simple question and i need a simple solution
I have a javascript file named a pricing.js which contains this content in it

var price_arr = new Array('$ 16.95','$ 30.95','$ 49.95','$ 70.95','$ 99.95','$ 109.95','$ 139.95','$ 155.95','$ 199.95','$ 460.95');

but i want to to update this part of javascript file using PHP so please help me in this how can i update this part of the content from javascript file using php?

'$ 16.95','$ 30.95','$ 49.95','$ 70.95','$ 99.95','$ 109.95','$ 139.95','$ 155.95','$ 199.95','$ 460.95'

Recommended Answers

All 3 Replies

Member Avatar for diafol

Why don't you store this data in a php file and pass it to js on page load as json? Also - do you need the $ in the items? That would probably be easier to prepend as you write the values to the tags. Maybe.

Yes i am planning to do something like this it would be easier also but i was asking if there is a simple way to update the item vlues which converts usd prices along with the currency symbol in british pound and in euro with symbol and pre defined prices

Also i have an idea which is really simple which change the pre defined js files
e.g. if currency is USD then load pricing-usd.js
and if gbp or euro then load relavent pricing file (pring-'xcurrencyx'.js)
but i dont think its a professional thing
Can you suggest if this idea is a professional?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.