Dawa www.shootmeagain.com | Hello, J'aimerais utiliser la widget autocomplete de jqueryui avec une source externe, donc un accès à ma DB qui doit rechercher environ 4000 entrées.
D'abord ce que j'ai compris, je dois :
- créer un script php qui va rechercher les entrées dans la DB Mysql et afficher le tout en format JSON
- avec le script autocomplete, aller chercher ce script comme source
C'est bien ça ? J'ai donc un fichier groupes.php qui manifestement crée bien un tableau en JSON :
Code :
- ["","#1 defender","(1) Kilo Of Black Bondage","(the) Silent Days","+\\- ( Plus\\Minus)","100 demons","1000 Travels Of Jawaharlal","108","12 Hour Turn","12XU","13 & God","13K","14weeks","16","16 Kat","16theday","1905","1969 Was Fine!","2 Fatties & The Bloody Beerbois","25","25 Ta Life","2nd District","3 INCHES OF BLOOD","3 Lost Maniacs","3 Seconds Of Air","31Knots","37 Stabwoundz","400Colpi","50 lions","5pack","64 Dollar Question","65daysofstatic","6Noir","7 generations","7 Seconds","7 Weeks","7EVENPM","8 UNEVEN","86 Mentality","86it","8aven","8control","95-C","A Case Of Grenada","A darker manifest","A day in black and white","A Day To Remember","A fear called treason","A Fine Boat That Coffin","A Flower Kollapsed","A Life Once Lost","A Lost Fear","A Modern Day Tragedy","A Perfect Mess","A Place To Bury Strangers","A School Of Quiet","A Static Lullaby","A storm of light","A thousand years slavery","A Traitor Like Judas","A Wilhelm Scream","A.M. Thawn","A.N.S.","A.S.T.R.O.","Aaron O'Neill","Abandon All Ships","Abject","Abney Park","Aborted","Absent","Absinthe (Provisoire)","Absurdity","Abysmal Dawn","Abysse","AC\/DC","Accalmie","Accept","Achilles","Acid China X","Acid Mothers Temple","Acid Tiger","Across Tundras","Actarus","Action","Action Beat","Actions Fall Short","Ad Arma","Ada Nuki","Adam Haworth Stephens","Adam Kesher","Adam West","Adequate 7","Admiral Freebee","Adolina","Adorno","Adrian Bouldt","Aenima","Aesthesia","AFI","Afraid!","After Blowdown","After Taste","Against Me !","Agaskodo Teliverek","Agatha","Age of compress","Age Of Torment","Agenda of swine","Agents of Abhorrence","Aghast","Aghostino","Agnostic Front","Agonia","Agonoize","Agoraphobic Nosebleed","Aguirre","AHELLAGOODBANDNAME","Aidan Baker","Aiden","Aids Wolf","Airbourne","Airlock","Airpeople","Airport City Express","Akimbo","Akro","Akron\/Family","Aktarum","Al Amor De La Lumbre","Al And The Black Cats","Alabama Thunderpussy","Alain Weber","Alchemik Babylon Beats","Alec Empire","Alek et Les Japonaises","Alexisonfire","Algernon","Algernon Cadwallader","Ali Harter","Alice In Chains","Alkaline Trio","Alkalys","Alkerdeel","All Else Failed","All For Nothing","All my sins","All Of Them","All Out War","All Parallels","All Pigs Must Die","All Shall Perish","All System Go!","All That Remains","All will suffer","Allegiance","Allocation","Almandino Quite Deluxe","Almond's Drive","Alpha & Omega","Alpha 2.1","Alpha and Omega","Alpinist","Alps Of New South Wales","Altars","Altars Of Destruction","Alternine","Al'tarba","Am I Dead Yet !","Amadeus","Amalthea","Amanda Rogers","Amanda woodward","Amber Daybreak","Amber Pacific","Ambitions","Ambush","Amebix",null,"Amen Ra","American Dog","Amity","Amon Amarth","Amon Tobin","Amorphis","Amort","Ampere","Ampools","Amsha","aMute","An Albatross","An Orange Car Crashed",null,"Anacharsis","Anal Cunt","Analena","Ananda","Anchor","Anchors For Arms","Ancient Sky","Ancient Vvisdom","And Say We Did","And So I Watch You From Afar","And You Will Know Us By The Trail Of Dead",null,"Andrew W.K.","Andromakers","Andy McKee","Andy Moor","Anemone","Anevilforeachman","Angel","Angel Crew","Angel Eyes","Angels Of Light","Angra","Angry Samoans","Angstzustand","Anima","ANIMOSITY","Anja Garbarek","Annita Babyface And The Tasty Poneys","Annotations Of An Autopsy"]
|
Bon j'ai enlevé une grosse partie parce que 4000 ça fait beaucoup.
Ca se trouve ici : http://www.shootmeagain.com/groupes.php
Ensuite le script autocomplete entre en jeu pour aller chercher ces données. Voici le bout de code en questions :
Code :
- <div CLASS='txt' align='left'>
- <script> $(function() { $( "#tags" ).autocomplete({ source: "groupes.php", minLength: 2, } }); });</script>
- <label for='tags'>Tags: </label><input id='tags'></div>
|
Bien sûr les différentes sources .js ont été appelées.
Par contre, ça ne fonctionne pas comme vous pouvez le voir ici : http://www.shootmeagain.com/index. [...] tocomplete
Quelqu'un verrait comme ça ce que j'ai pu rater et qui fait que ça ne fonctionne pas ?
Merci 1000x d'avance de votre aide ! ---------------
SHOOT ME AGAIN WEBZINE
|