Response title
This is preview!
$(document).ready(function(){
var str = $('#customer').val(); //get value of the selected option
$("#form1").submit(function(){
$.post(
"process.php",
str,
function(data){
alert(data) //just to test the value returned
}
);
});
return false;
});
</script>
</head>
<body>
<form id="form1" onsubmit="return false;">
<select id="customer" name="customer" size="" style='width:210px;>
<?php
$query="SELECT DISTINCT * FROM customerTable";
$result = Content($query);
while($row = mysql_fetch_array($result)) //values and the text for the options are fetched from database
{
if (($row['customer']) != NULL)
echo "<option name=customerOption type=text value='".$row['customerID']."' selected>".$row['customer']."</option>";
}
?>
</select>
<p id="submit_button">
<input value="Submit" type="submit">
</p></form>
$.post("process.php", {customer: str },
function(data) {
alert(data) //just to test the value returned
}
);
var str = $('#customer :selected').val();
$("#form1").submit(function(){
$.post(
"process.php",
str,
$.post(
"process.php",
{id: str},
© 2013 jQuery Foundation
Sponsored by and others.