trl20121212
2017-03-09 06:38ajax调用asp.net web api 2问题
2asp.net web api 2服务端
(url:http://localhost:4311/api/test/100):
namespace WebAPI.Controllers
{
public class TestController : ApiController
{
public string GetValue(int id)
{
return "Hello World" + id;
}
}
}
web调用端:
$("#btn1").click(function ()
{
$.ajax({
"url": "http://localhost:4311/api/test/100",
dataType: "json",
success:function(data)
{
alert(data);
}
});
});
问题是在IE中调用正常,可以显示数值,可到了firefox浏览器中却不能显示数值,在firebug中显示的错误是:SyntaxError:JSON.parse:unexpected end of data at line 1 column of the JSON data
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- 【小白提问】.net core 2.2 发布到IIS后 webapi 404错误
- c#
- visual studio
- asp.net
- 2个回答
- Jquery调用asp.net core web api开发的restful,post类型响应的却是get方法
- web api
- jquery
- asp.net
- 2个回答
- 微信H5支付,如何在后台.cs文档中调用前台JS的callpay()方法。ASP.NET
- javascript
- 支付
- 微信
- asp.net
- 3个回答
- c# 后台接收formdata对象 enctype="multipart/form-data"提交
- 4个回答