zoukankan      html  css  js  c++  java
  • ajax

    1.ajax异步

    有参数

     1)form表单

      $.ajax({
                                url: "Handle/OrderData.ashx?action=ScanCodeConfirm",  //一般处理程序
                                type: "post",
                                data: $("#form1").serialize() ,   //传递的数据
                                dataType: "json",   //数据类型json
                                success: function (data) {    //成功执行
                                    if (data.success) {


                                    }
                                    else {
                               
                                    }
                                }
                            });

    2)拼接

     $.ajax({
                                url: "Handle/OrderData.ashx?action=ScanCodeConfirm",
                                type: "post",
                                data: $("#form1").serialize() + "&g_pieces=" + g_pieces + "&g_length=" + g_length,
                                dataType: "json",
                                success: function (data) {
                                    if (data.success) {

                                     
                                    }
                                    else {
                                     
                                    }
                                }
                            });

    3) 

    $.ajax({
                    url: "/Handle/OrderData.ashx?action=RecSendUserInfo",
                    type: "post",
                    data:{countryID:countryID},
                    dataType: "json",
                    success: function (data) {
                        if (data.success) {
                        
                        }
                        else {
                        }
                    }
                });

    2.无参数

     function rec_iinfo()
            {
                $.ajax({
                    url: "Handle/OrderData.ashx?action=getRec",
                    type: "post",
                    dataType: "json",
                    success: function (data) {
                        if (data.success) {
                          
                        }
                    }
                });
            }

     详见:http://www.w3school.com.cn/jquery/ajax_ajax.asp

  • 相关阅读:
    标准maven配置setting文件
    zxing生成和解析二维码工具类
    Postman上传文件
    sql server工具类
    springboot开启token校验一直报错No 'Access-Control-Allow-Origin' header is present on the requested resource
    Jpa分页查询
    Restful接口调用统一异常处理
    npm install --save 、--save-dev 、-D、-S 的区别与NODE_ENV的配置(转载)
    element-ui el-table 组件实现跨表格多选
    微信小程序设置页面背景色的方式(全局或单页面)
  • 原文地址:https://www.cnblogs.com/1955/p/7928223.html
Copyright © 2011-2022 走看看