发送 Ajax 请求的代码格式如下:
- $$.ajax(parameters)
方法里参数可选值如下:
使用样例:
- $$(document).on('ajaxComplete', function (e) {
- var xhr = e.detail.xhr;
- console.log('request performed');
- });
- var $$ = window.Dom7;
- //do get request
- $$.get('path-to-file.php', {id:3}, function (data) {
- consol.log(data);
- }
- //do post request
- $$.post('path-to-file.php', {id:3}, function (data) {
- consol.log(data);
- }
- //get JSON request
- $$.getJSON('path-to-file.js', function (json) {
- consol.log(json);
- }