Package Name Test<label>Names</label>
<select id="NameDropDown" name="package_id"><option value="31">Test</
option></select>
I'm including (include PHP function) the packageNames.php file into
newproposal.php.
include('include/packageNames.php');
However on the page that is being displayed the query is empty and the
select / option fields are empty too.
file=> newproposal.php
SELECT package_id, package_name FROM proposal_packages WHERE cid = ""
GROUP BY package_name
What am I doing wrong? Honestly, I not all that jquery savvy. Any
help would be outstanding! My jquery code is below.
My jQuery
$(document).ready(function() {
$("select#cid").change(function() {
showCIDValue();
});
function showCIDValue() {
var cid = $('select#cid').val();
$.ajax({
type: "POST",
url: "include/packageNames.php",
data: "cid=" + cid,
beforeSend: function() {
$('#pkg').html('loading...');
},
dataType: "html",
success: function() {
adjustNameDropDown();
},
error: function() {
$('#pkg').html('error...');
},
});
}
function adjustNameDropDown() {
var cid = $('select#cid').val();
if (cid.length == 0) {
$('#NameDropDown').attr("disabled",true);
} else {
$('#NameDropDown').attr("disabled",false);
}
}
});