Wednesday, 15 April 2015

ajax - How do I use my ".selectedIndex;" value from select box as my index in my PHP request? -


I have a select box that uses "onchange" so that the user can choose the value based on the choice.

 Select  // Add function var Select Town = function (option) {var _dom_element = document.createElement ("select"); _dom_element.id = 'Selection Menu'; (Var i = 0; i & lt; options.length; i ++) for {var _option = document.createElement ("options"); _option.value = option [i]; _option.innerHTML = Option [i]; _dom_element.appendChild (_option); _dom_element.onchange = function () {var checkValue = document.getElementById ('Selection menu'). SelectedIndex; // Alert (option [check value]); }; } This.getDomElement = function () {return _dom_element; I menu selected value (hopefully made):  
  var _getWeatherInfo = function (ntown) {dojo.xhrget ({url: "PHP / weather.php? Ntown =" + ntown , Handle: "Jason", Timeout: 5000, Weight: Function (response) {_refreshWeatherList (response);}, Error: function (error_msg, response) {_handleError (error_msg);}}); }   

There was some confusion due to my last question, if you need more information or have been better explained then please ask me for any help!

You have to call _getWeatherInfo within the online function as function ! _dom_element.onchange = function () {var checkValue = document.getElementById ('selection menu'). SelectedIndex; _getWeatherInfo (checkValue); };

No comments:

Post a Comment