Update index.html
Browse files- index.html +19 -17
index.html
CHANGED
|
@@ -4,6 +4,8 @@
|
|
| 4 |
<title>
|
| 5 |
How To Get URL Parameters using JavaScript?
|
| 6 |
</title>
|
|
|
|
|
|
|
| 7 |
</head>
|
| 8 |
|
| 9 |
<body>
|
|
@@ -25,24 +27,24 @@ Current URL
|
|
| 25 |
|
| 26 |
<button onclick="getParameters()"> Get URL parameters </button>
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
<script>
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
</script>
|
| 47 |
|
| 48 |
|
|
|
|
| 4 |
<title>
|
| 5 |
How To Get URL Parameters using JavaScript?
|
| 6 |
</title>
|
| 7 |
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
| 8 |
+
|
| 9 |
</head>
|
| 10 |
|
| 11 |
<body>
|
|
|
|
| 27 |
|
| 28 |
<button onclick="getParameters()"> Get URL parameters </button>
|
| 29 |
|
| 30 |
+
<input type="text" id="input">
|
| 31 |
+
<button onclick="sendData()">Send Data</button>
|
| 32 |
+
<div id="output"></div>
|
| 33 |
<script>
|
| 34 |
+
function sendData() {
|
| 35 |
+
var value = document.getElementById('input').value;
|
| 36 |
+
$.ajax({
|
| 37 |
+
url: '/process',
|
| 38 |
+
type: 'POST',
|
| 39 |
+
data: { 'data': value },
|
| 40 |
+
success: function(response) {
|
| 41 |
+
document.getElementById('output').innerHTML = response;
|
| 42 |
+
},
|
| 43 |
+
error: function(error) {
|
| 44 |
+
console.log(error);
|
| 45 |
+
}
|
| 46 |
+
});
|
| 47 |
+
}
|
| 48 |
</script>
|
| 49 |
|
| 50 |
|