zoukankan      html  css  js  c++  java
  • AjaxPro.2 与 Jquery 的 Ajax 的混合使用

    AjaxPro.2 与 Jquery 的 Ajax 的混合使用 效果相当好,可以随心所欲

    //前台 代码 
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="AjaxPro.aspx.cs" Inherits="AjaxPro_Test" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            function ajaxTest() {
                AjaxPro_Test.AjaxProcTest(ajaxTestCallBack);
            }
            function ajaxTestCallBack() {
                alert('AjaxProcTest');
            }
    
            function JqueryAjaxTest() {
                $.ajax({
                    type: "GET",
                    url: "/ajax.asmx/AjaxProcTest",
                    contentType: "application/xml",
                    dataType: 'html',
                    error: function() { alert('error'); },
                    success: function(data) {
                        alert(data);
                    }
                });
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <input type="button" value="AjaxPro 无参调用" onclick="ajaxTest()" />
            <input type="button" value="JqueryAjax调用" onclick="JqueryAjaxTest()" />
        </form>
    </body>
    </html>
    
    //后台 代码
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class AjaxPro_Test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //注册
            AjaxPro.Utility.RegisterTypeForAjax(typeof(AjaxPro_Test));
        }
    
        [AjaxPro.AjaxMethod]
        public void AjaxProcTest()
        {
            // "AjaxPro 无参调用";
        }
    }
    
    //ajax.asmx 的代码
        [WebMethod]
        public string AjaxProcTest()
        {
            return "AjaxProcTest";
        }

    这种使用可以兼容ie6,7,8, firFox,Chorme

  • 相关阅读:
    oracle 内连接、外连接、自然连接、交叉连接练习
    oracle语句练习
    简单的oracle sql语句练习
    CountDownLatch 使用方法
    T1,T2,T3 三个线程顺序执行
    【2018 校招真题】斐波那契数列
    使用自己的域名解析 cnblogs 博客
    在 github 中新建仓库后,如何上传文件到这个仓库里面。
    数据库常用语句整理
    使用 JQuery 实现将 table 按照列排序
  • 原文地址:https://www.cnblogs.com/challengesoflife/p/2821391.html
Copyright © 2011-2022 走看看