2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-05 16:42:32 +03:00

add xDomainRequest adapter

This commit is contained in:
Vineet Hawal
2015-10-29 12:51:37 +05:30
parent 11c12b2c65
commit a59bc8d2ae
11 changed files with 1207 additions and 197 deletions
+4 -2
View File
@@ -10,7 +10,7 @@
<form role="form" class="form" onsubmit="return false;">
<div class="form-group">
<label for="data">JSON</label>
<textarea id="data" class="form-control" rows="5"></textarea>
<textarea id="data" class="form-control" rows="5">"data"</textarea>
</div>
<button id="post" type="button" class="btn btn-primary">POST</button>
</form>
@@ -24,7 +24,9 @@
document.getElementById('post').onclick = function () {
var data = document.getElementById('data').value;
axios.post('/post/server', JSON.parse(data))
axios.post('/post/server', data,{
xDomain : true
},JSON.parse(data))
.then(function (res) {
output.className = 'container';
output.innerHTML = res.data;
+1
View File
@@ -76,6 +76,7 @@ dirs = listDirs(__dirname);
server = http.createServer(function (req, res) {
var url = req.url;
res.setHeader("Access-Control-Allow-Origin", "*");
// Process axios itself
if (/axios\.min\.js$/.test(url)) {