- // jQuery
- $.get('url',
- function(data) {
- });
- $.post('url', {
- data: data
- },
- function(data) {
- });
- // 原生方法
- // get
- var xhr = new XMLHttpRequest();
- xhr.open('GET', url);
- xhr.onreadystatechange = function(data) {
- }
- xhr.send();
- // post
- var xhr = new XMLHttpRequest()
- xhr.open('POST', url);
- xhr.onreadystatechange = function(data) {
- }
- xhr.send({
- data: data
- });
来源: http://www.bubuko.com/infodetail-1954759.html