//javascript代码
$$(".bb").addEvent('change',function(e){
var order_item_id = this.get('order_item_id');
var product_name= this.value;
new Request.JSON({
url: "index.php?app=sale&ctl=admin_orders&act=ajax_discount",
onComplete: function(person, text){
if(person.status==1){
alert(person.msg);
}else{
alert("提交失败");
}
}
}).post('order_item_id='+order_item_id+'&product_name='+product_name);
});
//后台方法
function ajax_discount(){
$id = $_POST['order_item_id'];
$product_name = $_POST['product_name]
$order_item_mdl = $this->app->model('orders_item');
$order_item = $order_item_mdl->dump($id);
$order_item['product_name']=$product_name;
$order_item_mdl->save($order_item);
$result = array('status'=>1,'msg'='信息修改成功']);
echo json_encode($result);
}