roy_sanu
asked on
how to make ajax call on click event
is this the correct approach
$( "#rights").click( function() {
alert("sanu");
$.ajax({
type: "GET",
dataType: "json",
url: "/tile/mainRights.html",
success: function(json,sttext,response) {
}
if(json != null && json.length > 0) {
for(i = 0; i < json.length; i++) {
var obj = json[i].code;
var obj1 = json[i].descrip;
}
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
$.ajax({
type: 'GET', //or POST
url: 'WebForm1.aspx/MyMethod',
data: { },
dataType: 'json',
contentType: 'application/json; charset=utf-8',
success: function(data){
//do ur stuff here from data
}
});
});