2
I need to complete a form, according to the user’s demand, with Database information (Mysql).
Example:
I have the fields "Institution", "Course" and "Period". For the user, first, will appear only the option "Institution", so he select the desired institution will appear in the field below the course options and he will have visible the fields "Institution" and "Course"as soon as he selects the desired course will appear in the field below the period options and he will have visible the fields "Institution", "Course" and "Period".
Trying:
I used the following script to make the Ajax requests:
function consulta(){
var xmlreq = CriaRequest();
var result = document.getElementById("instituicao");;
xmlreq.open("GET", 'curso.php', true);
xmlreq.onreadystatechange = function(){
(readyState=4)
if (xmlreq.readyState == 4){
if (xmlreq.status == 200){
result.innerHTML = xmlreq.responseText;
}else{
result.innerHTML = "Erro: " + xmlreq.statusText;
}
}
};
xmlreq.send(null);
}
However I did not get the desired result because I would have to make a script like this for each demand.
Question:
Is there any way I can use JUST ONE SCRIPT for the three actions?
I don’t quite understand your example, I’m sorry but I’m still beginner. Could you please give me some practical example.
– Odair
See if Edit helps.
– Edgar Muniz Berlinck
@Edgarmunizberlinck and after user select how this selected data can be sent to mysql. My case is as http://answall.com/questions/181981/form-din%C3%A2mico-e-send-to-mysql-via-jquery-e-ajax? noredirect=1#comment376494_181981
– allan araujo