I am new to Ajax..I used a ajax in my application in that...OnSelect the name and date the ajax function goes to the php query file.
It performs the operation of sql and returns the row details in a ajaxDispaly variable...
My question is to display the row details separately in different text boxes....
My ajax code is
Expand|Select|Wrap|Line Numbers
- function ajaxFunction()
- {
- var student_id=document.frmMedicaldetail.student_id.value;
- var grade=document.frmMedicaldetail.grade.value;
- var ajaxRequest; // The variable that makes Ajax possible!
- try
- {
- ajaxRequest = new XMLHttpRequest();
- }
- catch (e)
- {
- try{
- ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch (e)
- {
- try{
- ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch (e)
- {
- alert("Your browser broke!");
- return false;
- }
- }
- }
- ajaxRequest.onreadystatechange = function()
- {
- if(ajaxRequest.readyState == 4)
- {
- var ajaxDisplay = ajaxRequest.responseText;
- var edit_sick = ajaxDisplay;
- //document.frmMedicaldetail.edit_age.value = edit_sick;
- alert(ajaxDisplay);
- }
- }
- var edit_date = document.getElementById('edit_date').value;
- if(grade!="" && student_id!="" && edit_date!="")
- {
- var queryString = "?grade=" + grade + "&student_id=" + student_id + "&edit_date=" + edit_date;
- ajaxRequest.open("POST","sick_ajax.php"+queryString,true);
- ajaxRequest.send(null);
- }
- }
- </SCRIPT>
Expand|Select|Wrap|Line Numbers
- $edit_date=$edit_date;
- $grade=$grade;
- $student_id=$student_id;
- $abr=mysql_query("select * from doc_detail where course_id='$grade' and d_date='$edit_date' and stud_id='$student_id' group by stud_id");
- $abr_row=mysql_fetch_array($abr);
- $edit_id = $abr_row['id'];
- $edit_age = $abr_row['age'];
- $edit_sex = $abr_row['sex'];
- $edit_adm_type = $abr_row['adm_type'];
- $edit_acc_year = $abr_row['acc_year'];
- $edit_complaints = $abr_row['complaints'];
- $edit_treatment = $abr_row['treatment'];
- $edit_remarks = $abr_row['remarks'];
- $edit_time = $abr_row['time'];
- echo $edit_age;
- echo $edit_sex;