Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.