diff --git a/sig-ask-devOsan.js b/sig-ask-devOsan.js
index ab9fa71..25b19c3 100644
--- a/sig-ask-devOsan.js
+++ b/sig-ask-devOsan.js
@@ -2,22 +2,79 @@
window.onload=init();
function init() {
+ var defaultText=`
+
Ask {dev}Osan
+
+
+
+ Fetching data...
+ `;
document.getElementsByClassName("sig-ask-devosan")[0].innerHTML=`
- Ask {dev}Osan.
-
- Fetching data...
`;
+
+
+ `;
+ document.getElementsByClassName("sig-ask-devosan1")[0].style.display="block";
+ document.getElementsByClassName("sig-ask-devosan1")[0].innerHTML=defaultText;
+ document.getElementsByClassName("sig-ask-devosan2")[0].style.display="none";
var req = new XMLHttpRequest();
req.onreadystatechange = function() {
if (this.readyState==4 && this.status==200) {
document.getElementsByClassName("sig-ask-devosan-popular")[0].innerHTML=this.responseText;
}
}
- req.open("POST","http://45.33.13.215/projects/dev-osan/dev-osan.github.io/sig-ask-devosan/popularquestions.php")
+ req.open("POST","http://45.33.13.215/projects/dev-osan/dev-osan.github.io/sig-ask-devosan/popularquestions.php",true)
req.send();
document.getElementsByClassName("sig-ask-devosan-popular")[0].innerHTML=`
Fetch data...
`;
}
+function submitQuestion() {
+ document.getElementsByClassName("sig-ask-devosan1")[0].style.display="none";
+ document.getElementsByClassName("sig-ask-devosan2")[0].style.display="block";
+ document.getElementsByClassName("sig-ask-devosan2")[0].innerHTML=`
+
+ `;
+ var req = new XMLHttpRequest();
+ req.onreadystatechange = function() {
+ if (this.readyState==4 && this.status==200) {
+ document.getElementsByClassName("sig-ask-devosan2")[0].innerHTML=this.responseText;
+ }
+ }
+ req.open("POST","http://45.33.13.215/projects/dev-osan/dev-osan.github.io/sig-ask-devosan/index.php",true)
+ req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ req.send(`question=${document.forms["q"]["question"].value}&name=${document.forms["q"]["name"].value}&email=${document.forms["q"]["email"].value}`);
+}
+
diff --git a/sig-ask-devosan/index.php b/sig-ask-devosan/index.php
index e0efbe1..9fa5533 100644
--- a/sig-ask-devosan/index.php
+++ b/sig-ask-devosan/index.php
@@ -1,4 +1,23 @@
".$_POST['question']."";
+ if (strlen($_POST['question'])>0) {
+ $question = $_POST['question'];
+ $name = $_POST['name'];
+ $email = $_POST['email'];
+ //echo "Posted Question: ".$_POST['question']."
";
+ if (strlen($_POST['name'])>0) {
+ //echo "Posted Name: ".$_POST['name']."
";
+ }
+ if (strlen($_POST['email'])>0) {
+ //echo "Posted Email: ".$_POST['email']."
";
+ }
+
+ //Submit the question to a polling list.
+ $file = fopen("./requests/requests.php","a");
+ fwrite($file,$question."
+".$name."
+".$email."
+");
+ } else {
+ echo "-1";
+ }
?>
\ No newline at end of file
diff --git a/sig-ask-devosan/requests/requests.php b/sig-ask-devosan/requests/requests.php
new file mode 100644
index 0000000..2a56c74
--- /dev/null
+++ b/sig-ask-devosan/requests/requests.php
@@ -0,0 +1,25 @@
+
+sig
+Yes
+fe1rf1feasvdzdz
+fdafdasgfreqw
+
+ffe1rfe3qwadafdasfdqa
+
+
+?<>>?>
+
+