Canman2005 Posted May 12, 2010 Share Posted May 12, 2010 Hi all I have a content loading script function ajaxLoader(url,id) { if (document.getElementById) { var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); } if (x) { x.onreadystatechange = function() { el = document.getElementById(id); el.innerHTML = ""; if (x.readyState == 4 && x.status == 200) { el = document.getElementById(id); el.innerHTML = x.responseText; } } x.open("GET", url, true); x.send(null); } } which works great. I then have a drop down HTML list which looks like <select name="products" onChange="ajaxLoader('product_list.php?value=(this.value)','contentarea');"> <option value="1">Apple</option> <option value="2">Dell</option> <option value="3">Logitech</option> </select> I then have a SPAN area <span id="contentarea"></span> in which "product_list.php" loads in. all I want to do, is pass the value of whatever option was selected So if "Dell" was selected, the call would be onChange="ajaxLoader('product_list.php?value=2','contentarea');" and if "Apple" was selected, the call would be onChange="ajaxLoader('product_list.php?value=3','contentarea');" but using (this.value) doesn't seem to be passing the selected value in the list can anyone help? I'm totally stumpted Thanks Dave Quote Link to comment Share on other sites More sharing options...
Zane Posted May 12, 2010 Share Posted May 12, 2010 Use the plus sign for concatenation in Javascript onChange="ajaxLoader('product_list.php?value='+this.value,'contentarea');" Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted May 12, 2010 Author Share Posted May 12, 2010 thank you very much Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.