4
The PHP code line below should be displayed on the website and is called using Javascript.
echo "
<div class='tipoPagamento' onclick='SelecionarTipoPagamento({$row['CODIGO']}, '{$row['TIPO']}');'>
<font color='#fff'>
<h4 style='margin-top: -15px;'>{$row['ESPECI']}</h4>
</font>
</div>
";
In the second line, in the tag div.. I have to call the function 'Selectpopagamento(int, str)'. As I indicated, it has an integer parameter and another string.. so I put the variable $Row['TYPE'] in quotes. But the function is not being called, because it is in error.
Removing the string parameter all works well and the code looks like this:
echo "
<div class='tipoPagamento' onclick='SelecionarTipoPagamento({$row['CODIGO']});'>
<font color='#fff'>
<h4 style='margin-top: -15px;'>{$row['ESPECI']}</h4>
</font>
</div>
";
I believe I do not know how to use the quotation marks correctly, but from what I saw on the Internet is correct... which would be the mistake?
I’m using the following scripts: (I’m specifying because I’ve heard that some do not accept single quotes or something like that)
<script src="js/jquery.min.js"></script>
<script src="js/database.js"></script>
<script src="js/jquery.poptrox.min.js"></script>
<script src="js/jquery.scrolly.min.js"></script>
<script src="js/jquery.scrollex.min.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/init.js"></script>
<script src="js/jquery.mask.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-wide.css" />
<link rel="stylesheet" href="css/style-normal.css" />
</noscript>
<script src="js/jquery-1.11.2.min.js"></script>
<script src="js/jquery.maskedinput.min.js"></script>
The function 'Selector()' is this:
function SelecionarTipoPagamento(cod, tipo){
alert("oi");
alert(cod);
alert(tipo);
codTipoPagamento = cod;}
It didn’t work. it seems that it calls the function instead of the general HTML with the string... since it returns the error: "Call to Undefined Function Selectpopagamento() in ... "
– renatoff