解决方案 »
- 按Enter键想让从一个TextBox跳到下一个TextBox,为什么确跑到 Button上面去了
- 关于大数据量查询的问题
- 如何把已经绑定的dropdownlist添加新项?(在Ajax的updatepanel里)
- .NET怎样实现文件的下载?????
- 100分的问题求解
- VB.NET 里做了一个网站,以前ASP是直接目录拷到IIS下,设一下就行,现在该怎么发布这个网站呢?
- msrdp.ocx(win远程桌面控件)的注册问题(已经郁闷几天了,请各位大虾帮帮忙!看看吧)
- gridview中为空时怎么跳过
- 请教各位高手
- VS与Dream的结合
- 问个拉姆达表达式排序问题····
- 在vs2010服务器资源管理器添加数据库链接时出错
如果要被jquery调用为啥不用ajax?
$(function () {
$.ajax({
type: "get",
url:"http://172.168.1.158:1945/Service1.svc/CategorySearch?jsoncallback=?",
dataType: "json",
success: function (employees) {
$.each(employees, function (index, value) {
var detailUrl = "detail.html?id=" + value.Category1Code;
var html = "<tr><td>";
html += value.Category1Code + "</td><td>";
html += "<a href='" + detailUrl + "'>" + value.ProductCategory1 + "</a></td><td>";
html += value.Category1Code + "</td><td>";
html += value.ProductCategory1 + "</td></tr>";
$("#employees").append(html);
});
$("#employees tr:odd").addClass("oddRow");
}
}); });
$.ajax({
type: "get",
url:"http://172.168.1.158:1945/Service1.svc/CategorySearch/hutianyi",
dataType: "jsonp",
success: function (employees) {
$.each(employees, function (index, value) {
var detailUrl = "detail.html?id=" + value.Category1Code;
var html = "<tr><td>";
html += value.Category1Code + "</td><td>";
html += "<a href='" + detailUrl + "'>" + value.ProductCategory1 + "</a></td><td>";
html += value.Category1Code + "</td><td>";
html += value.ProductCategory1 + "</td></tr>";
$("#employees").append(html);
});
$("#employees tr:odd").addClass("oddRow");
}
}); });后台实现方法前面加了这个 [WebGet(UriTemplate="hutianyi", ResponseFormat = WebMessageFormat.Json)],
结果还是调用不了,但是我在浏览器里面都能访问服务,也可以直接用这个url:http://172.168.1.158:1945/Service1.svc/CategorySearch/hutianyi 调到数据,不明白
配置文件中在system.servicemodel节点添加
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>试试
还有你客户端config生成不了把wcf的配置webHttpEndpoint和wsHttpBinding分别都试一下看看。
我传到前台是json数据,list在后台已经自动转为json了
<modules runAllManagedModulesForAllRequests="true"/>
这项配置后,jquery就不能调用,不知道为什么。