javascript - Automatically change dynamically pulled currency with a script -


i have resellers program currencies pound, dollar, japanese yen , euro.

i can set own prices display currency on users page baht.

the products , prices pulled dynamically on ruby on rails , have access code cant change currency baht.

my question is possible use script when page load replaces current values desired currency.

i.e if had value @ $1.00 script replace $ ฿ , times 1.00 33 user see ฿33 instead of $1.00.

here example of code allowed edit:

<script type='text/javascript'> // <[cdata[ // populate hashes in js context: var dual_core = new array(); <% dual_core.each |dc| %> dual_core["<%= dc.specific_type %>-<%= dc.base_renewal_period %>"] = new array(); dual_core["<%= dc.specific_type %>-<%= dc.base_renewal_period %>"]["specific_type"] = "<%= dc.specific_type %>"; dual_core["<%= dc.specific_type %>-<%= dc.base_renewal_period %>"]["base_renewal_period"] = "<%= dc.base_renewal_period %>"; dual_core["<%= dc.specific_type %>-<%= dc.base_renewal_period %>"]["unit_price"] = "<%= dc.unit_price %>"; dual_core["<%= dc.specific_type %>-<%= dc.base_renewal_period %>"]["quoted_unit_price"] = "<%= billing.price(dc.unit_price) %>"; dual_core["<%= dc.specific_type %>-<%= dc.base_renewal_period %>"]["display_price"] = "<%= billing.price(dc.unit_price, :use_tax_prefs) %>"; <% end %> var quad_core = new array(); <% quad_core.each |qc| %> quad_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"] = new array(); quad_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["specific_type"] = "<%= qc.specific_type %>"; quad_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["base_renewal_period"] = "<%= qc.base_renewal_period %>"; quad_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["unit_price"] = "<%= qc.unit_price %>"; quad_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["quoted_unit_price"] = "<%= billing.price(qc.unit_price) %>"; quad_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["display_price"] = "<%= billing.price(qc.unit_price, :use_tax_prefs) %>"; <% end %> var quad_core_bd = new array(); <% quad_core_bd.each |qc| %> quad_core_bd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"] = new array(); quad_core_bd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["specific_type"] = "<%= qc.specific_type %>"; quad_core_bd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["base_renewal_period"] = "<%= qc.base_renewal_period %>"; quad_core_bd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["unit_price"] = "<%= qc.unit_price %>"; quad_core_bd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["quoted_unit_price"] = "<%= billing.price(qc.unit_price) %>"; quad_core_bd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["display_price"] = "<%= billing.price(qc.unit_price, :use_tax_prefs) %>"; <% end %> var octo_core = new array(); <% octo_core.each |qc| %> octo_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"] = new array(); octo_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["specific_type"] = "<%= qc.specific_type %>"; octo_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["base_renewal_period"] = "<%= qc.base_renewal_period %>"; octo_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["unit_price"] = "<%= qc.unit_price %>"; octo_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["quoted_unit_price"] = "<%= billing.price(qc.unit_price) %>"; octo_core["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["display_price"] = "<%= billing.price(qc.unit_price, :use_tax_prefs) %>"; <% end %> var octo_core_fd = new array(); <% octo_core_fd.each |qc| %> octo_core_fd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"] = new array(); octo_core_fd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["specific_type"] = "<%= qc.specific_type %>"; octo_core_fd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["base_renewal_period"] = "<%= qc.base_renewal_period %>"; octo_core_fd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["unit_price"] = "<%= qc.unit_price %>"; octo_core_fd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["quoted_unit_price"] = "<%= billing.price(qc.unit_price) %>"; octo_core_fd["<%= qc.specific_type %>-<%= qc.base_renewal_period %>"]["display_price"] = "<%= billing.price(qc.unit_price, :use_tax_prefs) %>"; <% end %> var cpanel = new array(); <% cpanel.each |cp| %> cpanel["<%= cp.specific_type %>-<%= cp.base_renewal_period %>"] = new array(); cpanel["<%= cp.specific_type %>-<%= cp.base_renewal_period %>"]["specific_type"] = "<%= cp.specific_type %>"; cpanel["<%= cp.specific_type %>-<%= cp.base_renewal_period %>"]["base_renewal_period"] = "<%= cp.base_renewal_period %>"; cpanel["<%= cp.specific_type %>-<%= cp.base_renewal_period %>"]["quoted_unit_price"] = "<%= billing.price(cp.unit_price) %>"; cpanel["<%= cp.specific_type %>-<%= cp.base_renewal_period %>"]["display_price"] = "<%= billing.price(cp.unit_price, :use_tax_prefs) %>"; <% end %> var backup = new array(); <% backup.each |bk| %> backup["<%= bk.specific_type %>-<%= bk.base_renewal_period %>"] = new array(); backup["<%= bk.specific_type %>-<%= bk.base_renewal_period %>"]["specific_type"] = "<%= bk.specific_type %>"; backup["<%= bk.specific_type %>-<%= bk.base_renewal_period %>"]["base_renewal_period"] = "<%= bk.base_renewal_period %>"; backup["<%= bk.specific_type %>-<%= bk.base_renewal_period %>"]["quoted_unit_price"] = "<%= billing.price(bk.unit_price) %>"; backup["<%= bk.specific_type %>-<%= bk.base_renewal_period %>"]["display_price"] = "<%= billing.price(bk.unit_price, :use_tax_prefs) %>"; <% end %> // ]]> </script> <!-- <script type='text/javascript' src='<%= url_prefix %>ds.js'></script> --> <!-- include template ds-js.rhtml --> <% included_content_result = include_common_template("ds-js.rhtml", "@included_content_out_js") %> <%= included_content_result %> <div class='container' id='t-dedicated-servers'> <h2 id='effective-title'>dedicated servers</h2> <p> our range of dedicated servers provide either dual or quad core processors, include  unlimited bandwidth , perfect busy websites or hosting multiple websites on 1 machine. </p> <p> choose linux centos or windows web server 2008. servers setup  choice of operating system in 30 minutes our automated system. </p> <% @os_to_name = { "linux" => "linux (centos)", "windows" => "windows server 2008 web edition", "windows_se" => "windows server 2008 standard edition"} %> <form accept-charset='utf-8' method='post' action='basket' id='order-form'> <% if no_upsell? %><input type='hidden' name='no-upsell' value='1'/><% end %> <table style='border: 1'> <tbody> <tr> <% if dual_core_for_sale %>   <% @core_type = "2c" %>  <!-- include template ds-common.rhtml -->  <% included_content_result = include_common_template("ds-common.rhtml", "@included_content_out_two") %>  <%= included_content_result %>  <% end %> <% if quad_core_for_sale %>  <% if os_list['4c'].size > 0 %>    <% @core_type = "4c" %>   <!-- include template ds-common.rhtml -->   <% included_content_result = include_common_template("ds-common.rhtml", "@included_content_out_four") %>   <%= included_content_result %>   <% end # os_list[4c].size > 0 %>  <!-- quad core large disk -->  <% if quad_core_large_disk_for_sale %>    <% @core_type = "4c_bd" %>   <!-- include template ds-common.rhtml -->   <% included_content_result = include_common_template("ds-common.rhtml", "@included_content_out_four_b") %>   <%= included_content_result %>   <% end # quad_core_large_disk_for_sale %> <% end %> </tr> <tr> <% if octo_core_for_sale %>  <% if os_list['8c_bd'].size > 0 %>    <% @core_type = "8c_bd" %>   <!-- include template ds-common.rhtml -->   <% included_content_result = include_common_template("ds-common.rhtml", "@included_content_out_eight") %>   <%= included_content_result %>   <% end # os_list['8c'].size > 0 %>  <!-- octo (2xquad) core fast disk -->  <% if octo_core_fd_for_sale %>    <% @core_type = "8c_fd" %>   <!-- include template ds-common.rhtml -->   <% included_content_result = include_common_template("ds-common.rhtml", "@included_content_out_eight_b") %>   <%= included_content_result %>   <% end # octo_core_fd_for_sale %>  <% end %> </tr>   </tbody> </table> <% if free_products.size > 0 %> <p> if order dedicated server entitled 1 free registration minimum period of domain of 1 of following types:<br /> <% free_products.each_key |fp| %> <%= free_products[fp] %><br /> <% end %> </p> <% end %> <p><input type='submit' value='add basket' onclick='javascript: if(!get_selected_period()) { alert("please choose price , payment frequency");return false; } else { return true; };'/></p> </form> <% unless basket.nil? or basket.empty? or no_upsell? %> <p><a href='basket?add-no-product=ds'>no thank you, please continue order ....</a></p> <% end %> <% if not billing.tax_applies? %> <% elsif billing.include_tax? %>     <p>* includes <%= billing.tax_name %></p> <% else %>     <p>* excluding <%= billing.tax_name %></p> <% end %> </div>  <% =begin advice %>      section ignored , can safely removed.  <% =end advice %> 

i hope have explained enough understand.

thanks in advance reading or helping me.

i think should use soap webservice convert currency. can done using server side scripting on server or javascript soap client library on client side.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -