手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jquery $.ajax入门应用一
jquery $.ajax入门应用一
摘要:前台复制代码代码如下:无标题页//这个方法把ajax方法封装一下,方便调用。functionmyajax(){$.ajax({type:'g...

前台

复制代码 代码如下:

<!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>

<title>无标题页</title>

<script type="text/javascript" src="jquery/jquery.js"></script>

<script type="text/javascript">

//这个方法把ajax方法封装一下,方便调用。

function myajax(){

$.ajax({

type:'get',

url:'ajax.aspx',

data:'',

dataType:'html',

success:callback

});

}

//回调函数

function callback(data){

$('#response').append(data);

}

//onload()事件

$(function(){

$('#confirm').click(myajax);

})

</script>

</head>

<body>

<div id="confirm">点击</div>

<div id="response">接收后台数据</div>

</body>

</html>

后台

复制代码 代码如下:

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class ajax : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

Response.Write("hello");

Response.End();

}

}

【jquery $.ajax入门应用一】相关文章:

jQuery聚合函数实例

Jquery注册事件实现方法

jquery中map函数遍历数组用法实例

jquery滚动特效集锦

jQuery+ajax实现无刷新级联菜单示例

jQuery获取字符串中出现最多的数

jQuery处理图片加载失败的常用方法

jquery实现用户打分评分特效

JQuery中层次选择器用法实例详解

jquery任意位置浮动固定层插件用法实例

精品推荐
分类导航