asp.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