-
Notifications
You must be signed in to change notification settings - Fork 0
HTTP Request
ReactMVC edited this page Jul 1, 2023
·
3 revisions
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Elroid</title>
</head>
<body>
<script src="Elroid.js"></script>
<script>
const http = new ElRequest();
const url = "http://localhost:8000/api.php";
http.get(url, {}, (err, res) => {
if (err) {
console.log(err);
} else {
console.log(res);
}
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Elroid</title>
</head>
<body>
<script src="Elroid.js"></script>
<script>
const http = new ElRequest();
const url = "http://localhost:8000/api.php";
http.post(url, {}, (err, res) => {
if (err) {
console.log(err);
} else {
console.log(res);
}
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Elroid</title>
</head>
<body>
<script src="Elroid.js"></script>
<script>
const http = new ElRequest();
const url = "http://localhost:8000/api.php";
const data = {
name: 'Hossein',
};
http.get(url, data, (err, res) => {
if (err) {
console.log(err);
} else {
console.log(res);
}
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Elroid</title>
</head>
<body>
<script src="Elroid.js"></script>
<script>
const http = new ElRequest();
const url = "http://localhost:8000/api.php";
const data = {
name: 'Hossein',
};
http.post(url, data, (err, res) => {
if (err) {
console.log(err);
} else {
console.log(res);
}
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Elroid</title>
</head>
<body>
<script src="Elroid.js"></script>
<script>
const http = new ElRequest();
const url = "http://localhost:8000/api.php";
const data = {
name: 'Hossein',
};
http.setHeader('Authorization', 'Bearer token123');
http.setHeader('Content-type', 'application/x-www-form-urlencoded');
http.post(url, data, (err, res) => {
if (err) {
console.log(err);
} else {
console.log(res);
}
});
</script>
</body>
</html>
- get
- post
- put
- delete
- 1 - Installation
- 2 - Quick Start
- 3 - Simple syntax
- 4 - Components
- 5 - Routing
- 6 - HTTP Request