データベースからデータを入力するスクリプトがありますが、変数を使用しようとしている変数selected
が使用されていないようです。私が言いたいのは、Netbeans が変数が使用されていないと言っているということです。スクリプトに何か問題がありますか?
function get_child_options(selected)
{
if (typeof selected === 'undefined')
{
var selected = ' ';
}
var parentID = jQuery('#parent').val();
jQuery.ajax(
{
url: '/MyProjectName/admin/parsers/child_categories.php',
type: 'POST',
data:
{
parentID: parentID,
selected: selected
},
success: function(data)
{
jQuery('#child').html(data);
},
error: function()
{
alert("Something went wrong with the child options.")
},
});
}
jQuery('select[name="parent"]').change(get_child_options);