我是网络服务的新手。在我的项目中,当我尝试运行时,我连接了 Web 服务(一切都是现成的),但出现以下错误。
错误 -->
Uncaught SyntaxError: Unexpected token <
Web 服务和我的页面位于相同的解决方案中,但项目不同。
相关代码如下:
jQuery (网址:11761)
 function GetAllCategories() {
   $.ajax({
      url: "http://localhost:12015/myWebService.asmx?op=GetCategories",
      type: "POST",
      dataType: "jsonp",
      data: "{}",
      contentType: "application/jsonp; charset=utf-8",
      success: function (data) {
          var categories = data.d;
          $.each(categories, function (index, category) {
              alert(category.CategoryId);
          });
      },
      error: function (e) {
          alert(e.message);
      }
   });
}
网络服务(网址:12015)
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List<Categories>  GetCategories()
{
    //Code
}
在问这里之前我已经浏览了这个链接(无法理解)
编辑:
从这篇文章中得到了替代答案。