-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
74 lines (58 loc) · 2.22 KB
/
index.html
File metadata and controls
74 lines (58 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html>
<head>
<title>PHP case study 1</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="case study GOY quiz the office" />
<meta name="author" content="saz" />
<link rel="stylesheet" href="css/stile.css">
<!--css funziona senza relative path
usare ctrl + F5 nel caso non aggiornasse la risorsa css,
questo farà reload e refresh -->
<!--JQ CDN-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("#colore").on("change", function() {
var c = $("#colore").val();
//http request si confonde con il codice # del colore esadecimale
var col = c.replace("#","%23");
//si fa una chiamata ajax che fa partire una chiamata XMLHTTPRequest, che sarebbe una HTTPRequest tutta sua asincrona
$.ajax({
url:"sfondo.php",
type:"GET",
data: "c="+col
})//se funziona
.done(function(response){
$("html").css("background-color", c);
$("#prova").html(response);
console.log(c);
})//se non funziona
.fail(function(xhr, resp, text){
console.log(xhr, resp, text);
$("#prova").html(xhr+resp+text);
});
});
});
</script>
</head>
<body>
<div>
<h2>LOGIN PAGE</h2>
<p>Pagina per accedere al quiz del corso</p>
</div>
<div>
<form action="login.php" method="POST">
<!--elemento riempito dalla chiamata ajax-->
<span id="prova"></span>
<span>che sfondo vuoi?
<input type="color" id="colore" name="colore" required>
</span><br/><br/>
<input type="text" name="user" required><br/><br/>
<input type="password" name="pass" required> <br/><br/>
<input type="Submit" value="invia">
</form>
</div>
</body>
</html>