473,480 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

problem in sending a ajax variable in to php variable

vivekgs2007
60 New Member
Hi to all,
I am new to Ajax. I have a application form. which has a edit option of the previous record of a user.
when a user select the date at which he wants to edit the records.then the ajax function calls performs the operation and gives the result...its all working properly...but the ajax response is dispalyed in only in text box not in drop down list...please help me around this..
Ajax code is
Expand|Select|Wrap|Line Numbers
  1.  
  2.     function ajaxFunction()
  3.     { 
  4.  
  5.         var student_id=document.frmMedicaldetail.student_id.value;
  6.         var grade=document.frmMedicaldetail.grade.value;
  7.         var ajaxRequest; // The variable that makes Ajax possible!
  8.         try
  9.         {
  10.             ajaxRequest = new XMLHttpRequest();
  11.         } 
  12.         catch (e)
  13.         {
  14.             try{
  15.             ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
  16.             } 
  17.             catch (e) 
  18.             {
  19.                 try{
  20.                 ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
  21.             }
  22.             catch (e)
  23.             {
  24.                 alert("Your browser broke!");
  25.                 return false;
  26.             }
  27.             }
  28.         }
  29.  
  30.             ajaxRequest.onreadystatechange = function()
  31.             {
  32.                 if(ajaxRequest.readyState == 4)
  33.                 {
  34.  
  35.                     var ajaxDisplay = ajaxRequest.responseText;
  36.                     //document.frmMedicaldetail.edit_age.value = edit_sick;
  37.                     data = ajaxDisplay.split ( "<br/>" );
  38.                     document.frmMedicaldetail.age.value = data[0];
  39.  
  40.                 }
  41.             }
  42.  
  43.             var edit_date =  document.getElementById('edit_date').value;
  44.  
  45.             if(grade!="" && student_id!="" && edit_date!="")
  46.             {  
  47.                 var queryString = "?grade=" + grade + "&student_id=" + student_id + "&edit_date=" + edit_date;
  48.                 ajaxRequest.open("POST","sick_ajax.php"+queryString,true);
  49.                 ajaxRequest.send(null);
  50.             }        
  51.  
  52.  
  53.     }      
  54.  
It is displayed in the input box
Expand|Select|Wrap|Line Numbers
  1. <input type='text' name='age' value=''> 
  2.  
Not in Drop down box
Jun 3 '10 #1
3 1525
Dormilich
8,658 Recognized Expert Moderator Expert
but the ajax response is dispalyed in only in text box not in drop down list
this is because in the readystatechange handler you only change the textbox.
Jun 3 '10 #2
vivekgs2007
60 New Member
@Dormilich
So What I have to do..please help
Jun 3 '10 #3
Dormilich
8,658 Recognized Expert Moderator Expert
include the dropdown update in the handler (currently I can say nothing about how to do that, because I don’t know your code).
Jun 3 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3482
by: UrgeOverkill | last post by:
I'm having a problem sending data from a socket server. The server side reports that it has sent 4845 bytes but the client reports only 1448 bytes received. The kicker is that this ONLY happens...
10
1598
by: Tanteauguri | last post by:
Hi List, is there in python a variable variable like in PHP ($$var)? What I want to do is something like that: pc= for i in pc: i = anyclass() a.shutdown()
2
1738
by: dondraper | last post by:
I have an application that uses a popular but simple set of JavaScript routines that implement an AJAX call used to populate a drop-down. It works for thousands of user but I have one customer...
0
1168
by: totalstranger | last post by:
I'm hoping someone can help figure out how to stop a message that appears to be generated by my web host when sending to an non-resolvable email address that is supported by my web host. Things...
1
1223
by: mdthanh | last post by:
Hi All! Please help me. I got problem with AJAX atlas & Ultragird, atfer sorting the column my webpage get Javascript error. Anyone have experience on this on please help. I falled on them 3...
0
1120
by: duclm | last post by:
Hi all, II am having problem sending zip file(binary file) using webrequest function from wince5.0 device to a webpage. It works fine for any file with size less than or equal to 1.5kb. Any bigger...
3
1281
nirmalsingh
by: nirmalsingh | last post by:
hai All, i have found a major problem in ajax. datas are not secured while we send through data through url parameters from javascript to behind screen server page the url with parameters is...
17
1535
by: bhappy | last post by:
Hai All, I got one problem in ajax.im applying ajax for 3 dropdown lists when im selecting 3 dropdown values in first time it is working, in 2nd time it is taking the request as postback for same...
1
2958
by: hesameagle | last post by:
Hi I want to use ajax to connect to database and echo some data in my page, I wrote these two codes that can handle my need: index.php ----------------------------------------- <?php ...
2
2750
ThatThatGuy
by: ThatThatGuy | last post by:
Hello reader,, This might be a very simple question, but what to just say about it, i'm facing it Actually i'm developing a web App and i want email feature in that.... I'm sending mail from my...
0
7046
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7088
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5342
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4783
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4485
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2997
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
183
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.