Framework7 ajax


发送 Ajax 请求的代码格式如下:

  1. $$.ajax(parameters)

方法里参数可选值如下:

 

 

 

 

使用样例:

  1. $$(document).on('ajaxComplete', function (e) {
  2. var xhr = e.detail.xhr;
  3. console.log('request performed');
  4. });

常用的ajax和jquery是一样一样哒。

  1. var $$ = window.Dom7;
  2. //do get request
  3. $$.get('path-to-file.php', {id:3}, function (data) {
  4.   consol.log(data);
  5. }
  6.  
  7. //do post request
  8. $$.post('path-to-file.php', {id:3}, function (data) {
  9.   consol.log(data);
  10. }
  11.  
  12. //get JSON request
  13. $$.getJSON('path-to-file.js', function (json) {
  14.   consol.log(json);
  15. }