This is js code
//GET SUB CATEGORY VALUES
$("#sp_mainC").change(function(){
var kamui = $("#sp_mainC option:selected").val();
$.ajax({
url:'request.php',
data:{'kamui':kamui},
type:'POST',
success:function(result){
var sonuc = $.parseJSON(result);
for (var i =0; i < sonuc.length; i++) {
$("#sp_subC option:eq("+i+")").attr('val', sonuc[i]['sp_id']);
$("#sp_subC option:eq("+i+")").text(sonuc[i]['sp_name']);
}
}
});
});//GET SUB CATEGORY VALUES END
This is php code
if ($_POST['kamui']) {
$kakashi = $_POST['kamui'];
echo $query = " SELECT *
FROM CATEGORY1
WHERE sp_main = '".$kakashi."'";
$work = odbc_exec($baglanti, $query);
$rarr = array();
while($abcd = odbc_fetch_array($work))
{
$array = array();
$array['sp_id'] = iconv('ISO-8859-9', 'UTF-8', $abcd['sp_id']);
$array['sp_name'] = iconv('ISO-8859-9', 'UTF-8', $abcd['sp_name']);
$array['sp_main'] = iconv('ISO-8859-9', 'UTF-8', $abcd['sp_main']);
$rarr[] = $array;
}
//$result = odbc_fetch_array($work);
echo json_encode($rarr);
}
I am using MS SQL for queries. When I choosing main category data sending to request.php successfully but I am getting data ($_POST['kamui]) it doesn't work. How can I solve this problem ?