ecstore中怎样使用ajax提交数据
程序员文章站
2023-12-25 21:09:21
//javascript代码 $$(".bb").addEvent('change',function(e){ var order_item_id = this.get('order_item_id'); var product_name= this.value; new Request.JSON(... ......
//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); }
推荐阅读