Jump to content

Ajax Function Not Working


emjez15

Recommended Posts

:(This is my Ajax Function for my select list Year Level to change what is in the database..

 

 xmlhttp4.onreadystatechange=function()
     {
 var lol1;
 var lol2;
 var fir;
 var sec;
 //document.form1.yearlvl.selectedIndex = 3;
       if(xmlhttp4.readyState==4 && xmlhttp4.status==200)
       {
   sec = xmlhttp4.responseText;
   lol1 = sec.replace("\n", "");		
	   switch(lol1)
	   {
			case "1st":
				document.form1.yearlvl.selectedIndex = 1;
				break;
			case "2nd":
				document.form1.yearlvl.selectedIndex = 2;
				break;
			case "3rd":
				document.form1.yearlvl.selectedIndex = 3;
				break;
			case "4th":
				document.form1.yearlvl.selectedIndex = 4;
				break;
	   }
       }
     } 

 

And This is my Select List in HTML

 

<select name = yearlvl id = yearlvl>
<option>Choose Year Level</option>
  	<option value = "1st">1st Year</option>
       <option value = "2nd">2nd Year</option>
       <option value = "3rd">3rd Year</option>
<option value = "4th">4th Year</option>
</select>

 

I don't know why it doesn't seem to work T___T

Thanks for any help

-EM

Link to comment
https://forums.phpfreaks.com/topic/226030-ajax-function-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.