Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ariele Luciano Sgheiza
Portfolio CUI
Commits
aba505fd
Commit
aba505fd
authored
Dec 05, 2020
by
Loic DAVID
Browse files
ajout methode pour creer HTML depuis JS
parent
efa150ca
Pipeline
#21280
failed with stages
in 29 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
index.css
View file @
aba505fd
...
...
@@ -78,4 +78,14 @@ header{
text-align
:
center
;
}
.recherche
{
height
:
200px
;
width
:
200px
;
background
:
rgb
(
31
,
216
,
6
);
}
.searchResultButton
{
height
:
200px
;
margin-top
:
13px
;
margin-bottom
:
13px
;
margin-right
:
13px
;
}
\ No newline at end of file
index.html
View file @
aba505fd
...
...
@@ -31,7 +31,8 @@
</div>
</header>
<div
id=
"div1"
></div>
</body>
...
...
test.js
View file @
aba505fd
...
...
@@ -13,23 +13,33 @@ function test3(){
*/
//afficher les projet lié à une recherche
function
addRechercheResultat
(
nomProjet
,
idProjet
)
{
var
newDiv
=
document
.
createElement
(
"
div
"
);
var
newContent
=
document
.
createTextNode
(
''
);
newDiv
.
appendChild
(
newContent
);
newDiv
.
innerHTML
=
"
<div class='recherche'>
"
+
nomProjet
+
"
<button type='submit' class='searchResultButton' id='submit' onclick='addElement(
"
+
idProjet
+
"
)'> </div>
"
//changer adElement() par la méthode qui permettra de charger la page d'un projet
var
currentDiv
=
document
.
getElementById
(
'
div1
'
);
document
.
body
.
insertBefore
(
newDiv
,
currentDiv
);
}
function
rechercher
(){
var
motRecherche
=
document
.
getElementById
(
"
search
"
).
value
;
axios
.
get
(
'
http://127.0.0.1:2555/recherche/
'
,
{
params
:
{
motClef
:
motRecherche
}
})
.
then
(
response
=>
{
window
.
location
=
'
recherche.html
'
;
/*
window.location='recherche.html';
for(var i=0; i<response.data.length;i++){
}
/*var listeTitresProjets = "";
}*/
var
listeTitresProjets
=
""
;
for
(
var
i
=
0
;
i
<
response
.
data
.
length
;
i
++
){
listeTitresProjets
=
listeTitresProjets
+
response
.
data
[
i
].
titre_projet
;
if
(
i
<
response
.
data
.
length
-
1
)
listeTitresProjets
=
listeTitresProjets
+
"
,
"
;
addRechercheResultat
(
response
.
data
[
i
].
titre_projet
,
response
.
data
[
i
].
id_projet
)
}
document.getElementById("test").innerHTML= listeTitresProjets;*/
//document.getElementById("test").innerHTML= listeTitresProjets;
})
.
catch
(
error
=>
{
console
.
log
(
error
)
...
...
@@ -73,4 +83,7 @@ function getProfilInfos(){
.
catch
(
error
=>
{
console
.
log
(
error
)
})
}
\ No newline at end of file
}
document
.
body
.
onload
=
addElement
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment