Javascript code: dynamically change currencies with dropdown HTML

后端 未结 3 1027
小鲜肉
小鲜肉 2021-01-25 22:34

I have been looking for this all day - Change currencies throughout the page when choosing between countries or currencies from dropdown menu.

What I basically need is a

3条回答
  •  庸人自扰
    2021-01-25 22:53

    The beauty of webapps is that you can borrow good ideas by looking a the source code (using a toll like the Firebug plugin in FF). As you can see in the example you mention the page is reloaded when a different currency is chosen:

    $('#Items, #Items_input').change(function(){
        $.post('/conlogic/ajax.php?action=currency',
            {'curr': $(this).val()},
            function(data){
                if ( data=="OK" ) window.location.reload();
            });
    });
    

    Apparently in this case the page is re-rendered server side with the different currency.

提交回复
热议问题