手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >使用Jquery Aajx访问WCF服务(GET、POST、PUT、DELETE)
使用Jquery Aajx访问WCF服务(GET、POST、PUT、DELETE)
摘要:复制代码代码如下:usingjqueryajaxcallwcfserviceget/post/put/deletehttp://www.co...

复制代码 代码如下:

using jquery ajax call wcf service get/post/put/delete

http://www.codeproject.com/Articles/254714/Implement-CRUD-operations-using-RESTful-WCF-Servic

Using POST Method

Retrieve a representation of the addressed member of the collection, in the example below, create a new entry in the collection.

Collapse | Copy Code

$.ajax({

type: "POST",

url: "Services/EFService.svc/Members/",

data: "{Email:'test@test.com', ScreenName:'TestUser'}",

contentType: "application/json; charset=utf-8",

dataType: "json",

success: function (data) { // Play with response returned in JSON format },

error: function (msg) {

alert(msg);

}

}); Using PUT Method

Update the entire collection with another collection, in the example below, update the addressed member of the collection.

Collapse | Copy Code

$.ajax({

type: "PUT",

url: "Services/EFService.svc/Members/",

data: "{Email:'test@test.com', ScreenName:'TestUser'}",

contentType: "application/json; charset=utf-8",

dataType: "json",

success: function (data) { // Play with response returned in JSON format },

error: function (msg) {

alert(msg);

}

});Using DELETE Method

Delete the entire collection or a specific collection, in the example below, delete Member with id=1.

Collapse | Copy Code

$.ajax({

type: "DELETE",

url: "Services/EFService.svc/Members(1)",

data: "{}",

contentType: "application/json; charset=utf-8",

dataType: "json",

success: function (data) { // Play with response returned in JSON format },

error: function (msg) {

alert(msg);

}

});

使用Jquery Aajx访问WCF服务(GET、POST、PUT、DELETE)1

使用Jquery Aajx访问WCF服务(GET、POST、PUT、DELETE)2

【使用Jquery Aajx访问WCF服务(GET、POST、PUT、DELETE)】相关文章:

多附件上传组件演示

理解javascript定时器中的setTimeout与setInterval

JavaScript检测字符串中是否含有html标签实现方法

jQuery实现转动随机数抽奖效果的方法

javascript实时显示当天日期的方法

JQuery boxy插件在IE中边角图片不显示问题的解决

javascript委托(Delegate)blur和focus用法实例分析

10条建议帮助你创建更好的jQuery插件

JQuery控制Radio选中方法分析

JavaScript实现仿网易通行证表单验证

精品推荐
分类导航