pass field to php = data = null
I'm trying to send a value of a select list to php script. I'm using jquery/ajax. When I try to run the function, I get an error message in firebug saying that data = null - like the value is not at all passed to the script :S
here's the js I'm using to pass the value
btw the top bit is for something else
- $(function(){
$('#load').click(function(){
$.getJSON('load.php', function(data) {
$('#sections').val(data.Sections);
$('#fontColor').val(data.Fontcolor);
$('#bgcolor').val(data.BackgroundColor);
$('#font').val(data.Font);
$('#fontSize').val(data.FontSize);
$('#lineHeight').val(data.LineHight);
$('#letterSpacing').val(data.LetterSpacing);
$('#fontStyle').val(data.FontStyle);
});
var configSelect = $('#configSelect').attr('value');
// var dataStr = ;
$.ajax({
type: "POST",
url: "load.php",
data: {configSelect:configSelect}
});
});
});
and here's the php to get the value
- $configSelect = $_REQUEST['configSelect'];
this is the html for the select list
- <select id="configSelect" onFocus="reloadList()">
<option></option>
<?php
mysql_connect('localhost', 'root', 'pass');
mysql_select_db('ipsum');
$sql = "SELECT Name FROM con";
$result = mysql_query($sql);
while($rows = mysql_fetch_array($result)){
$name = $rows[0];
echo "<option value=\"$name\" name=\"$name\">$name</option>";
}
?>
</select>