I have selectbox and I using XMLHttpRequest to load values to second selectbox also I am using JQuery selectmenu. The problem is after I select an item from first selectbox the second selectbox changing but won't initialize JQuery selectmenu. Any suggestion?
var xmlHTTP; function GetXmlHttpObject() { xmlHTTP=null; try { xmlhttp=new XMLHttpRequest(); } catch (e) { try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } } } function getAdultRoom(room_id) { if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } if(xmlhttp == null) { alert("Your browser not support the AJAX"); return; } var $element = jQuery.noConflict(); var url = "ajax_fetch_room.php?room_id="+$element('#room_type').val()+"&side_check_in_date="+$element('#side_check_in_date').val()+"&side_check_out_date="+$element('#side_check_out_date').val(); xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("roomadult").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET",url,true); xmlhttp.send(null); }
I figure it out. I added $('select').selectmenu(); to onreadystatechange