手机
当前位置:查字典教程网 >编程开发 >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取消ajax请求的方法

jquery预加载图片的方法

jquery插件validation实现验证身份证号等

Jquery中基本选择器用法实例详解

jquery表单对象属性过滤选择器用法

jQuery 遍历函数详解

jQuery中 prop() attr()使用详解

JQuery中基础过滤选择器用法

jquery滚动特效集锦

精品推荐
分类导航