博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
DevExtreme 学习应用[2]
阅读量:4687 次
发布时间:2019-06-09

本文共 1500 字,大约阅读时间需要 5 分钟。

DevExtreme 学习应用[2]

调用WebService数据

1那么首先建立WebService

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Services;namespace WebService{    ///     /// WebService 的摘要说明    ///     [WebService(Namespace = "http://tempuri.org/")]    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]    [System.ComponentModel.ToolboxItem(false)]    [System.Web.Script.Services.ScriptService]    //以上这句要有 不然会报错  因为手机开发一般是要以Json形式获取数据
public class WebService : System.Web.Services.WebService    {        [WebMethod]        public string HelloWorld()        {            return "Hello World";        }    }}

2HTML

3JavaScript  该JS是以Jquery的形式调用的。所以只要做过Jquery的都比较清楚

Application1.ProductDetial = function (params) {    var viewModel = {        find: function () {            $.ajax({                url: 'http://localhost:5421/WebService/WebService.asmx/HelloWorld',                data: {},                //data:{} 因为我们在这里测试的使用的HelloWord 方法是无参的。所以这里为空。要是有参数的方法  如参数为Name:data:{name:'李四'}  备注:这里的参数名 最好和服务端的参数名称一致                 contentType: "application/json",                dataType: "json",                type: "POST",                success: function (result) {                    alert(result.d);                },                error: function (xml, status) {                    alert(status);                }            });        }    };    return viewModel;};

 总结:DevExtreme 开发中调试通了 调用C# WebService的方法。

 

 

 

转载于:https://www.cnblogs.com/w2011/p/3423219.html

你可能感兴趣的文章
RSA System.Security.Cryptography.CryptographicException
查看>>
s的封装和信息隐蔽
查看>>
excelhttp://www.cnblogs.com/caoyuanzhanlang/p/3591904.html
查看>>
ArrayList和LinkedList和Vector源码分析
查看>>
webservice整合spring cxf
查看>>
再次编译这个应用程序应该不会有问题
查看>>
Ubuntu-tomcat7目录
查看>>
189. Rotate Array
查看>>
asp.net 的三种开发模式
查看>>
Android 交叉编译 IPerf3
查看>>
Android原生Gallery关于图像Orientation的问题
查看>>
[解题报告] 100 - The 3n + 1 problem
查看>>
Entity Framework 学习高级篇1—改善EF代码的方法(上)
查看>>
Mybatis逆向工程配置文件详细介绍(转)
查看>>
数组 Arrays类
查看>>
String类的深入学习与理解
查看>>
OLTP vs OLAP
查看>>
一些题目(3)
查看>>
Eclipse下配置主题颜色
查看>>
杂题 UVAoj 107 The Cat in the Hat
查看>>