I'm trying to call a function by clicking on a link, where a parameter is passed that will be used in an Ajax request.
This request will return results that will be added to a div.
The link code for the function call is as follows:
<a href="javascript:;" id="Iniciais" onclick="pBuscaFichaEmergencia('<?php echo $Letra; ?>');"><?php echo $Letra; ?></a>
The function code is:
function pBuscaFichaEmergencia(){
var Iniciais = $('#Iniciais').val();
console.log("INICIAL: " + Iniciais);
if (Iniciais) {
var url = 'pBuscaFichasLetras.php?Iniciais='+Iniciais
$.get(url, function(dataReturn) {
$('#resp-emergencia').html(dataReturn);
});
}
}