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

  • 相关阅读:
    为什么需要域驱动设计(DDD)?
    什么是无所不在的语言?
    什么是耦合?
    什么是 Spring Cloud?
    你更倾向用那种事务管理类型?
    您对微服务有何了解?
    微服务架构有哪些优势?
    微服务架构如何运作?
    @Qualifier 注解 ?
    JdbcTemplate ?
  • 原文地址:https://www.cnblogs.com/1955/p/7928223.html
Copyright © 2011-2022 走看看