Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do ajax call in an API using Framework7

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.

like image 249
Sydney Loteria Avatar asked Dec 26 '22 00:12

Sydney Loteria


1 Answers

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);
});
like image 109
Vladimir Kharlampidi Avatar answered Jan 07 '23 22:01

Vladimir Kharlampidi