Compare commits
4 Commits
8983f0dd80
...
f451850601
Author | SHA1 | Date | |
---|---|---|---|
f451850601 | |||
3bc6a56516 | |||
536af5f9c5 | |||
e5bdf2cc2c |
@@ -7,9 +7,11 @@
|
||||
<body>
|
||||
<div id="root">
|
||||
<h1>Link Shortener</h1>
|
||||
<form id="form" action="result.js">
|
||||
<form id="form" method="GET" action="result.php" onsubmit="return validate()">
|
||||
|
||||
<!-- <form id="form"> -->
|
||||
<label for="url">URL:</label><span class="mandatory">*</span>
|
||||
<input type="text" name="url" id="URL" value="example.com" required><br><br>
|
||||
<input type="text" name="url" id="URL" value="https://example.com" required><br><br>
|
||||
|
||||
<label for="labels">GLink:</label><span class="mandatory">*</span>
|
||||
<label for="GLink" id="labels" class="glink">glink.zip/</label><input type="text" name="glink" id="GLink" class="glink" value="exampleWebsite" required>
|
||||
|
17
index.js
17
index.js
@@ -1,7 +1,7 @@
|
||||
const submit = document.getElementById("button");
|
||||
submit.addEventListener('click', validate);
|
||||
function validate(e) {
|
||||
e.preventDefault();
|
||||
//const submit = document.getElementById("button");
|
||||
//submit.addEventListener('click', validate);
|
||||
function validate() {
|
||||
// e.preventDefault();
|
||||
|
||||
const url = document.getElementById("URL");
|
||||
const glink = document.getElementById("GLink");
|
||||
@@ -48,7 +48,13 @@ function validate(e) {
|
||||
error.setAttribute('aria-hidden', true);
|
||||
error.setAttribute('aria-invalid', false);
|
||||
console.log("Valid");
|
||||
return valid;
|
||||
|
||||
return valid;
|
||||
|
||||
/* var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.open('GET','result.php',true);
|
||||
xmlhttp.send();
|
||||
console.log(xmlhttp.responseText);*/
|
||||
} else {
|
||||
|
||||
/*flag*/
|
||||
@@ -62,6 +68,7 @@ function validate(e) {
|
||||
url.classList.add("invalid");
|
||||
error.setAttribute('aria-hidden', false);
|
||||
error.setAttribute('aria-invalid', true);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@@ -1,3 +1,5 @@
|
||||
console.log('Beginning database execution');
|
||||
|
||||
const cassandra = require('cassandra-driver');
|
||||
|
||||
const client = new cassandra.Client({
|
||||
@@ -5,4 +7,8 @@ const client = new cassandra.Client({
|
||||
keyspace: 'glink',
|
||||
});
|
||||
|
||||
const query =
|
||||
const query = 'SELECT name FROM data WHERE id = ?';
|
||||
|
||||
console.log(query);
|
||||
|
||||
client.execute(query, [5]).then(result => console.log('User name is %s',result.rows[0].name));
|
||||
|
19
result.php
Normal file
19
result.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
use Casssandra;
|
||||
|
||||
$cluster = Cassandra::cluster()->build();
|
||||
$keyspace = 'glink';
|
||||
|
||||
$session = $cluster->connect($keyspace);
|
||||
|
||||
$statement = new Cassandra\SimpleStatement('SELECT name FROM data WHERE id=5');
|
||||
|
||||
$future = $session->executeAsync($statement);
|
||||
$result = $future->get();
|
||||
|
||||
foreach ($result as $row) {
|
||||
printf("The name is %s",$row['name']);
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user