@ -2,22 +2,79 @@
window . onload = init ( ) ;
window . onload = init ( ) ;
function init ( ) {
function init ( ) {
var defaultText = `
< h3 style = "margin-top:24px;" > Ask < span style = "color: #696035" > { < / s p a n > d e v < s p a n s t y l e = " c o l o r : # 6 9 6 0 3 5 " > } < / s p a n > O s a n < / h 3 >
<!-- < input type = "text" style = "width:85%" name = "question" value = "What would you like to know?" > < input type = "submit" > -- >
< form name = "q" "action=" # formanchor " onsubmit=" submitQuestion ( ) ; return false ; " >
< div class = "input-group input-group-lg" >
< div class = "input-group-prepend" >
< span class = "input-group-text" id = "inputGroup-sizing-lg" > Q < / s p a n >
< / d i v >
< input type = "text" class = "form-control" placeholder = "What would you like to know?" aria - label = "Question" aria - describedby = "inputGroup-sizing-lg" name = "question" required >
< / d i v >
< br >
< div class = "container" >
< div class = "row" >
< div class = "col-5" >
< div class = "input-group input-group-sm" >
< input type = "text" id = "name" class = "form-control" placeholder = "Name (Optional)" aria - describedby = "namehelp" >
< / d i v >
< small id = "namehelp" class = "form-text text-muted" >
Your name will be displayed next to the question .
< / s m a l l >
< / d i v >
< div class = "col-7" >
< div class = "input-group input-group-sm" >
< input type = "text" id = "email" class = "form-control" placeholder = "Email (Optional)" aria - describedby = "namehelp" >
< / d i v >
< small id = "namehelp" class = "form-text text-muted" >
Providing an email will send you a notification when your question has been answered .
< / s m a l l >
< / d i v >
< button class = "btn btn-primary col-3 m-2" type = "submit" > Submit < / b u t t o n >
< / d i v >
< / d i v >
< / f o r m >
< hr >
< div class = "sig-ask-devosan-popular" > Fetching data ... < / d i v >
` ;
document . getElementsByClassName ( "sig-ask-devosan" ) [ 0 ] . innerHTML = `
document . getElementsByClassName ( "sig-ask-devosan" ) [ 0 ] . innerHTML = `
< h1 > Ask { dev } Osan . < / h 1 >
< div class = "sig-ask-devosan1" > < / d i v >
< form name = "ask-devosan" method = "POST" action = "http://45.33.13.215/projects/dev-osan/dev-osan.github.io/sig-ask-devosan/index.php" >
< div class = "sig-ask-devosan2" > < / d i v >
< input type = "text" style = "width:85%" name = "question" value = "What would you like to know?" > < input type = "submit" >
` ;
< / f o r m >
document . getElementsByClassName ( "sig-ask-devosan1" ) [ 0 ] . style . display = "block" ;
< div class = "sig-ask-devosan-popular" > Fetching data ... < / d i v > ` ;
document . getElementsByClassName ( "sig-ask-devosan1" ) [ 0 ] . innerHTML = defaultText ;
document . getElementsByClassName ( "sig-ask-devosan2" ) [ 0 ] . style . display = "none" ;
var req = new XMLHttpRequest ( ) ;
var req = new XMLHttpRequest ( ) ;
req . onreadystatechange = function ( ) {
req . onreadystatechange = function ( ) {
if ( this . readyState == 4 && this . status == 200 ) {
if ( this . readyState == 4 && this . status == 200 ) {
document . getElementsByClassName ( "sig-ask-devosan-popular" ) [ 0 ] . innerHTML = this . responseText ;
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 ( ) ;
req . send ( ) ;
document . getElementsByClassName ( "sig-ask-devosan-popular" ) [ 0 ] . innerHTML = `
document . getElementsByClassName ( "sig-ask-devosan-popular" ) [ 0 ] . innerHTML = `
Fetch data ...
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 = ` <hr>
< button class = "btn btn-primary m-2" type = "button" disabled >
< span class = "spinner-border spinner-border-sm" role = "status" aria - hidden = "true" > < / s p a n >
Submitting Question ...
< / b u t t o n >
` ;
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 } ` ) ;
}