Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Bom dia galera,
estou criando um ajax onde eu insiro datas através de um popup, mas só q num ta funcionando e chamando o script.
incluir_aluno_particular.php
echo "<div id='ar' style=\"display: none\" class='cgrt_edif_popup roundborderselected'><p> ";
echo "<table width=500 align=center cellspacing=2 cellpadding=2 class='roundborderselectedinv'>";
echo "<tr>";
echo "<td class='text' align=center colspan=2><b>Informe aqui um novo período</b></td>";
echo "</tr>";
echo "</table>";
echo "<table width=500 height=200 align=center cellspacing=2 cellpadding=2 class='text roundborderselectedinv'>";
echo "<tr>";
echo "<td align='right' class='text' width=230>Data Início:</td>";
echo "<td class='text' width=270><input size=9 name='inicio' id='inicio' class='inputTextobr' onkeydown=\"return only_number(event);\" OnKeyPress=\"formatar(this, '##/##/####');document.getElementById('notif_inicio').style.display = 'none';\" maxlength=10> <span id='notif_inicio' style=\"display: none;\" class='text10 roundborderselectedred'>Formato inválido!</span></td>";
echo "</tr>";
echo "<tr>";
echo "<td align='right' class='text' width=230>Data Término:</td>";
echo "<td class='text' width=270><input size=9 name='termino' id='termino' class='inputTextobr' onkeydown=\"return only_number(event);\" OnKeyPress=\"formatar(this, '##/##/####');document.getElementById('notif_termino').style.display = 'none';\" maxlength=10> <span id='notif_termino' style=\"display: none;\" class='text10 roundborderselectedred'>Formato inválido!</span></td>";
echo "</tr>";
echo "<tr><td height=100%></td><td width=270></td></tr>";
echo "</table>";
echo "<table width=500 align=center cellspacing=2 cellpadding=2>";
echo "<tr>";
echo "<td class='text' align=center colspan=2 class='roundbordermix'>";
echo "<input class='btn' type=button value='Salvar' name='btnSaveArInfo' id='btnSaveArInfo' onclick=\"save_periodo(inicio, termino);\">";
echo " ";
echo "<input class='btn' type=button value='Cancelar' name='btnCancelArInfo' id='btnCancelArInfo' onclick=\"hide_cgrt_edif_vent_art();\">";
echo "</td>";
echo "</tr>";
echo "</table>";
echo '</div>';
sist.js
function periodo(inicio, termino){
var url = "ajax/ajax_save_periodo.php?";
if(document.getElementById('inicio').value.length <10){
document.getElementById('notif_inicio').style.display = "inline";
return false;
}
if(document.getElementById('termino').value.length <10){
document.getElementById('notif_termino').style.display = "inline";
return false;
}
url += "&inicio=" + document.getElementById('inicio').value;
url += "&termino=" + document.getElementById('termino').value;
url = url + "&cache=" + new Date().getTime();
cgrt.open("GET", url, true);
cgrt.onreadystatechange = save_periodo_reply;
cgrt.send(null);
}
ajax_save_periodo.php
header("Content-Type: text/html; charset=ISO-8859-1",true);
include "../database/conn.php";
$inicio = $_GET[inicio];
$termino = $_GET[termino];
$sql = "INSERT INTO periodo (inicio_periodo, fim_periodo)
VALUE ('$inicio', '$termino')";
$res = mysql_query($sql);
Se alguem puder em ajudar agradeço.
Carregando comentários...