I need to pass two parameters via url
and create a JS function to get these parameters and place them in the source of a script.
Follow what I already have.
Link to the parameters: <a href="<?php bloginfo( 'url' ); ?>/cotacao?id=17&fonte=Verdana">Dólar</a>
Function to get parameters:
<script>
var url = window.location.search.replace("?", "");
var items = url.split("&");
var array = {
'id' : items[0],
'fonte' : items[1]
}
var id = array.id;
var fonte = array.fonte;
//alert(id);
//alert(fonte);
</script>
Script where the id and source variables should come from:
<!-- Widgets Notícias Agrícolas - www.noticiasagricolas.com.br/widgets -->
<script type="text/javascript" src="http://www.noticiasagricolas.com.br/widget/cotacoes.js.php?ID&FONTE&tamanho=10pt&largura=500px&cortexto=333333&corcabecalho=B2C3C6&corlinha=DCE7E9&imagem=true&output=js"></script>
Errorreturned:
Link image: image