I'm following the tutorial on how to retrieve value from selection but it keeps getting the old productID value.
I'm following this code from Ahmed with the Northwind demo.
in order_details-dv.js
Code: Select all
$j(function(){
/** On changing product, retrieve unit price from products table and populate unit price field */
$j('#ProductID-container').on('change', function(){
var pid = $j('#ProductID').val();
if(pid == '{empty_value}'){
$j('#UnitPrice').val('');
}else{
$j.ajax({
url: 'hooks/ajax-product-price.php?pid=' + pid,
data: { pid: pid },
success: function(data){
//$j('#UnitPrice').val(data);
alert(pid);
}
});
}
// }
});
});
Code: Select all
<?php
$cuffDir = dirname(__FILE__). '/..';
include("$cuffDir/defaultLang.php");
include("$cuffDir/language.php");
include("$cuffDir/lib.php");
/* grant access to all users who have access to the order_details table */
$od_from = get_sql_from('order_details');
if(!$od_from){
header('HTTP/1.0 401 Unauthorized');
exit;
}
$pid = intval($_REQUEST['pid']);
$unit_price = sqlValue("select UnitPrice from products where ProductID='{$pid}'");
echo $unit_price;
?>
Do you guys know what is the problem? Is it because of the Appgini version?
I'm using version 5.95