데이터베이스에서 데이터를 채울 수있는 스크립트가 있지만 변수를 사용하려고 시도하는 변수 selected
이 사용되지 않는 것 같습니다. 내 말은 Netbeans이 변수가 사용되지 않는다고 말합니다. 스크립트에 문제가 있습니까?JQuery Unused Variable Error
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);
'var selected'는 (는) 블록 범위 밖에 있습니다. @dxcorzo가 그의 답변에서 보여지기 전에'if (typeof' – bhantol
이 함수 params에 이미 정의되어 있습니다.)'var'을 제거하십시오. – Shanimal