【问题标题】:How To Do CRUD Operations in WEBAPI in asp.net using AJAX如何使用 AJAX 在 asp.net 中的 WEB API 中进行 CRUD 操作
【发布时间】:2016-04-09 05:35:46
【问题描述】:

我想使用 AJAX JQuery 在 asp.net 中对 WEB API 执行 CRUD 操作。我对 web api 很陌生

【问题讨论】:

  • 你的问题太宽泛了,你必须做一些研究然后开始。如果您有任何技术编码问题,请在此处发布。
  • 尝试向这个post学习,但他使用的是knockoutjs而不是jQuery。

标签: c# asp.net asp.net-web-api asp.net-web-api-routing wcf-web-api


【解决方案1】:

以下代码可用于通过 GET 请求访问 web api

    var url1 = 'http://api.com/customer/1234';

    $.ajax({
        url: url1,
        type: 'GET',
        headers: {
            'customHeader': 'Value',
            'customHeader2': 'Value2'
        },
        success: function (data) {
            alert('Success');
        }
    });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-19
    • 2019-03-03
    • 1970-01-01
    • 2021-08-07
    • 1970-01-01
    • 2019-05-20
    • 2012-07-10
    相关资源
    最近更新 更多