Content feed Comments Feed

The Official ASATO Site

Hi, welcome to my blog. ASP,asp.net,Health,Javascript,JQUERY

easy ajax by use jquery

Posted by admin On May - 8 - 2009

In this article,we will get date from use ajax with jquery.First we must include jQuery in the head of our page,here is the jquery website.
The code like this:

?View Code CSHARP
1
<script type="text/javascript" src="js/jquery-1.3.2.min.js" ></script>

once we done this,and we can begin to work using AJAX in Jquery.

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$.ajax({
  type: "get",//define the type of request for example: POST/GET.
  dataType:"html",//format the data being received is in. (HTML, XML, JSON, script etc..)
  url: "getInfo.aspx?id="+id, //the URL to make the request to
  cache:false,
  beforeSend: function(XMLHttpRequest){
	//
  },
  success: function(data,textStatus){
	alert(data);
  },
  complete: function(XMLHttpRequest, textStatus){
	//
  },
  error: function(){
	//
  }
});

getInfo.aspx.cs

?View Code CSHARP
1
Response.Write("OK");

Leave a Reply