如何在asp.net的Web服务中使用Jason formate [英] how to use Jason formate in web services in asp.net
本文介绍了如何在asp.net的Web服务中使用Jason formate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友......我是asp.net的新8n网络服务员。任何人都可以告诉我如何使用JSON格式来发送和接收数据而不是XML。请给我一个链接,从哪里我可以获得面糊的概念。在此先感谢
解决方案
希望你想从你的aspx页面调用json。若是,那么请使用此代码。
< script type =text / javascript>
函数GetDescription(a){
// alert(a); //下拉项目选择值
.ajax({
类型:'POST',
contentType:application / json; charset-8;,
url:'WT.aspx / GetRef',//在这里你可以调用你的webservice&方法
data:'{id:'+ a +'}',//传递参数
成功:OnSuccess,
错误:函数(数据){//返回数据的webservice
alert(data.d);
}
});
函数OnSuccess(数据){//绑定到控件
var abc = data.d;
var desc,unitprice,sp;
sp = abc.split(|);
(#<%= lbldesc.ClientID%>)。text(sp [0]);
Hello friends ... i am new 8n web servicees in asp.net . Can anyone tell me how to use JSON formate to send and recieve data instead of XML . Please send me a link from where i can get batter concept. Thanks in advance
解决方案Hope you want to call json from your aspx page. if it so, then use this code.
<script type="text/javascript"> function GetDescription(a) { // alert(a); // the dropdown item selected value
.ajax({ type: 'POST', contentType: "application/json; charset-8;", url: 'WT.aspx/GetRef', //here you can call your webservice & its method data: '{ id:' + a + '}',//pass arguments success: OnSuccess, error: function (data) {//webservice which returns data alert(data.d); } }); function OnSuccess(data) {//binding to the controls var abc = data.d; var desc, unitprice, sp; sp = abc.split("|");
("#<%=lbldesc.ClientID %>").text(sp[0]);
这篇关于如何在asp.net的Web服务中使用Jason formate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文