Have javascript right, but need to pass variable with ajax, WILL GIVE REP! function showBox() { var selectBox = document.getElementById("store").value; if (selectBox == 'N') { document.getElementById("penyard").style.display="none"; }else{ document.getElementById("penyard").style.display="block"; } } Code (markup): so how do I pull the value of selectBox to php without refreshing the page. penyard needs the value of selectBox to know what to display.
data = 'store='+selectBox; $.post("page.php",data,function(response, status, xhr) { if (status == "error") { alert("Error:"+ xhr.status + " " + xhr.statusText); } else { Alert("sucess"); } }); Code (markup): On page.php, you will get the value $_POST['store'];