I have a problem with my ajax, I need to check another page if a time is available. I select the consultant field and type the day, after that, by clicking the button, it should bring a return if it is free or busy, but it is not doing.
Here's how it was and how I'm trying to do it.
<a href="#" onClick="var myAjax = new Ajax.Updater('agenda_horario', '/php/clientes/carrega_horario_consultor.php?id_consultor='+document.forms[0].id_consultor.value+'&data_agendamento='+document.forms[0].data_agenda.value+'&id_franquia=<?=$id_franquia?>', {method: 'post', parameters: 'foo=bar'})" class="btn btn-confirma">Verificar horários ocupados</a>
I'm trying to do
function carregaHorario() {
var myAjax = new Ajax.Updater('agenda_horario', '/php/clientes/carrega_horario_consultor.php?id_consultor='+document.forms[0].id_consultor.value+'&data_agendamento='+document.forms[0].data_agenda.value+'&id_franquia=<?=$id_franquia?>',
{
type: 'POST',
dataType: 'json',
parameters: 'foo=bar'
})
}
Next error appears
Uncaught TypeError: Cannot read property 'value' of undefined
at HTMLAnchorElement.onclick (VM2462 a_controle_visitas1a.php:834)
I hope you can help me, thank you.