$(function () {
$("#getdata").click(function () {
/*$.ajax({
type: 'Post',
url: 'http://localhost:65497/WebSite1/WebService.asmx/GetAge?id=3344',
// data: '{id:"bbut101"}',
// data: 'id=bbut101',
// dataType: 'json',
dataType: 'xml',
contentType: "application/json",
success: function (data) {
$("#data").append(data.d);
}
});*/
//alert("3333333333");
//htmlobj = $.ajax({ url: "http://localhost:65497/WebSite1/WebService.asmx/GetAge", async: false }); //$("#data").html(htmlobj.responseText); /*// $.post("http://localhost:65497/WebSite1/WebService.asmx/GetAge",
{ id: "Duckburg" },
function (data, status) {
alert("数据:" + data + "\n状态:" + status);
});*/
/*$.ajax({
type: "GET",
contentType: "UTF-8",
url: "http://localhost:65497/WebSite1/WebService.asmx/GetAge?id=3322",
dataType: 'jsonp',
// dataType: 'text',
success: function (data) {
alert(data);
}
});
$.ajax({
type: "POST",
contentType: "application/json;charset=utf-8",
url: "http://localhost:65497/WebSite1/WebService.asmx/GetAge?id=44333",
data: "{id:12345 }",
dataType: 'jsonp',
success: function (response) {
alert("成功:" + response.d);
},
error: function (msg) {
alert("错误:" + msg);
}
})*/
//jQuery.support.cors = true; //IE10以下 $.ajax({
type: "post",
url: "http://localhost:65497/WebSite1/WebService.asmx/GetAge?id=44333",
//dataType: 'xml', dataType: 'text',
data: { id: 'eve7777' },
success: function (data) {
alert(data); //xml对象 //document.write(data); //$("#data").append(data); },
error: function (XMLHttpRequest, textStatus, errorThrown) {
//console.log(XMLHttpRequest); alert('error:' + errorThrown);
//$("#data").append(errorThrown); }
});
});
});
获取dddd数据