How to do ajax call in an API using Framework7

Sydney Loteria picture Sydney Loteria · Jan 2, 2015 · Viewed 15.2k times · Source

How can I do an ajax call using Framework7? I already know how to do ajax call using jQuery but I don't know how to do it in Framework7. I am using this for calling an API that returns data.

Answer

Vladimir  Kharlampidi picture Vladimir Kharlampidi · Jan 5, 2015

You can include jQuery or use default Dom7 library, it has the same Ajax methods:

var $$ = window.Dom7;

//do get request
$$.get('path-to-file.php', {id: 3}, function (data) {
  console.log(data);
});

//do post request
$$.post('path-to-file.php', {id: 3}, function (data) {
  console.log(data);
});

//get JSON request
$$.getJSON('path-to-file.js', function (json) {
  console.log(json);
});