How to access the Asp.Net data using JQuery:
The below article simple example how to access the web method returns values using JQuery.
JQuery:
JQuery with Asp.Net:
JQuery is on JavaScript file. We need to include this file on our web applications. I don’t have idea if this able to use on dot net 1.1 Version. We can able to use on 2.0 and above dot net versions.
In dot net 2.0 versions JQuery is not Intellisense. It’s an Intellisense above dot net 2.0 versions.
Steps for JQuery installation on Asp.Net:
1.Download JQuery application from http://jquery.com [Latest Release].
2.Add the .js file web application.
3.Include the .js file in your web page.
Access the web service using JQuery:
The below elements to known before create access method.
Coding:
function ajaxJson() {
$.ajax({
type: "POST",
url: "JSON.asmx/AjaxJSON",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
var data = eval("(" + msg + ")");
var t = "" + " "; jQuery.each(data, function(rec) { workflow = workflow + " "; }); t = t + "
";
$("#jsonDiv").html(workflow);
},
error: function(msg) {
}
});
};
.
The below article simple example how to access the web method returns values using JQuery.
JQuery:
- JQuery is library of java script functions.
- JQuery is light-weight component.
- Write less Do More.
- Cross – browser independent.
JQuery with Asp.Net:
JQuery is on JavaScript file. We need to include this file on our web applications. I don’t have idea if this able to use on dot net 1.1 Version. We can able to use on 2.0 and above dot net versions.
In dot net 2.0 versions JQuery is not Intellisense. It’s an Intellisense above dot net 2.0 versions.
Steps for JQuery installation on Asp.Net:
1.Download JQuery application from http://jquery.com [Latest Release].
2.Add the .js file web application.
3.Include the .js file in your web page.
Access the web service using JQuery:
The below elements to known before create access method.
- $.ajax() is a JQuery Method to make AJAX calls.
- Type=”Post”
- Data – Used to pass the parameter to web method.
- contentType – “applicaton/json; charset=utf-8” for JSon Web service.
- Datatype : JSON
- Success : This function is called after success processing happened.
Coding:
function ajaxJson() {
$.ajax({
type: "POST",
url: "JSON.asmx/AjaxJSON",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
var data = eval("(" + msg + ")");
var t = "" + " "; jQuery.each(data, function(rec) { workflow = workflow + " "; }); t = t + "
| Journal | " + "Volume | " + "Issue | " + "Article |
| " + this.journal + " | " + this.volume + " | " + this.issue + " | " + this.article + " |
$("#jsonDiv").html(workflow);
},
error: function(msg) {
}
});
};
.
No comments:
Post a Comment