naveendk.55 Posted November 6, 2012 Share Posted November 6, 2012 I am trying to send multiple values to ajax variable(value) from multiple dropdown list. However, this is not working. I want multiple values to be stored in ajax variable if I select more than one dropdown value. Any help plz? Below is the ajax code: var xmlHttp1; var xmlHttp1; var str = new Array(); //xmlHttp.setRequestHeader( "Content-Type", "application/json" ); function showState1(str){ if (typeof XMLHttpRequest != "undefined"){ xmlHttp1= new XMLHttpRequest(); } else if (window.ActiveXObject){ xmlHttp1= new ActiveXObject("Microsoft.XMLHTTP"); } if (xmlHttp1==null){ alert("Browser does not support XMLHTTP Request"); return; } var url="test.jsp"; url +="?value=" +str; xmlHttp1 .onreadystatechange = stateChange1; xmlHttp1.open("POST", url, false); xmlHttp1.send(null); } function stateChange1(){ if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete"){ document.getElementById("functUnit").innerHTML=xmlHttp1.responseText ; } } Quote Link to comment https://forums.phpfreaks.com/topic/270348-sending-array-of-values-to-ajax-from-multiselect-dropdown/ Share on other sites More sharing options...
codefossa Posted November 7, 2012 Share Posted November 7, 2012 If you want to store it locally, then just have an array and push it to it when you want to store more. If you want to get it ready to post, then check out serialize(). Quote Link to comment https://forums.phpfreaks.com/topic/270348-sending-array-of-values-to-ajax-from-multiselect-dropdown/#findComment-1390684 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.