1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | body: '' , method: 'GET' , mode: 'same-origin' , dataType: 'text' , }) .then(response => { return response.text(); // => 返回一个 `Promise` 对象 }) .then(data => { Modal.alert( 'success:' + JSON.stringify(data)) }) . catch (error => { Modal.alert( 'error:' + JSON.stringify(error)) }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | method: 'POST' , body: 'id=233&t=20161013' , mode: 'same-origin' , dataType: 'text' , }) .then(response => { return response.text(); // => 返回一个 `Promise` 对象 }) .then(data => { Modal.alert( 'success:' + JSON.stringify(data)) }) . catch (error => { Modal.alert( 'error:' + JSON.stringify(error)) }); |
上述代码中body
参数只能是search string形式。QAP-SDK提供了Object to search string的方法,详情请参考toQueryString章节。