zoukankan      html  css  js  c++  java
  • ecstore中怎样使用ajax提交数据

        //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);
        }
  • 相关阅读:
    Fusion access
    组网架构
    DHCP中继
    Vxlan配置
    redis多实例
    ansible实现redis角色
    ansible如何ssh免密链接(基于key验证)
    MySQL主从复制
    MySQL范例
    Ubuntu2004安装
  • 原文地址:https://www.cnblogs.com/yangzailu/p/10743852.html
Copyright © 2011-2022 走看看