Skip to content

Commit

Permalink
🐛 fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Copyes committed Mar 6, 2018
1 parent 022c4cf commit f770d1f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test-cross/cors/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,15 @@
<body>

</body>
<script>
const xhr = new XMLHttpRequest();
xhr.open('GET', 'http://127.0.0.1:3000', true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
alert(xhr.responseText);
}
}
xhr.send(null);
</script>

</html>
11 changes: 11 additions & 0 deletions test-cross/cors/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const http = require('http')
http
.createServer((req, res) => {
res.writeHead(200, {
'Access-Control-Allow-Origin': 'http://127.0.0.1:8080',
'Content-Type': 'text/html;charset=utf-8'
})
res.end('这是你要的数据:1111')
})
.listen(3000, '127.0.0.1')
console.log('The server is listening to 127.0.0.0')

0 comments on commit f770d1f

Please sign in to comment.