How to use the framework7.request function in framework7

To help you get started, we’ve selected a few framework7 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gaynetdinov / ex_money / assets / js / app.js View on Github external
$$('.tr-li').on('swipeout:deleted', function (e) {
    var id = $$(e.target).children("div.swipeout-actions-opened").find("a.delete-transaction").data('id');
    var csrf = document.querySelector("meta[name=csrf]").content;

    Framework7.request({
      url: '/m/transactions/' + id + "?_format=json",
      contentType: "application/json",
      type: 'DELETE',
      headers: {
        "X-CSRF-TOKEN": csrf
      },
      success: function(data, status, xhr) {
        var response = JSON.parse(data);
        if (response.new_balance) {
          $$("#account_id_" + response.account_id).text(response.new_balance);
        }
      },
      error: function(xhr, status) {
        alert("Something went wrong, check server logs");
      }
    });