[ajax][codeigniter] Autocomplete is not a function

Pagina: 1
Acties:

Acties:
  • 0 Henk 'm!

  • Dorgaldir
  • Registratie: September 2009
  • Laatst online: 10-04 22:52

Dorgaldir

Creature of the web

Topicstarter
Ik probeer een auto search met ajax te maken in een codeigniter site.
Ik laad dit in in de header:
HTML:
1
2
3
4
5
6
7
8
9
10
11
<?php 
    if (isset($load_jquery)){
        if ($load_jquery == true){ ?>
            <link href="<?php echo base_url(); ?>theme/js/jquery/jquery-ui.css" rel="stylesheet" type="text/css" />
            
            <script type="text/javascript" src="<?php echo base_url(); ?>theme/js/jquery/external/jquery/jquery.js"></script>
            <script type="text/javascript" src="<?php echo base_url(); ?>theme/js/jquery/jquery-ui.js"></script>
            <script type="text/javascript" src="<?php echo base_url(); ?>theme/ajax/search.js"></script>
    <?php 
        }
    }?>


echter zie ik in chrome:
Afbeeldingslocatie: http://static.tweakers.net/ext/f/QGOxrExxxiU5KVqqao9zHfda/thumb.png

mijn eerste vraag: zou daar de jquery-ui.js ook niet tussen moeten staan? De link is correct en de file staat op de server, toch lijkt het voor mij alsof die niet geladen word en het daarom dus ook niet werkt.

Indien dat het probleem niet zou zijn:
de search.js bevat deze code
JavaScript:
1
2
3
4
5
$(function(){
  $("#product").autocomplete({
    source: "configuration/get_products" 
  });
});


en daar komt dus de error:
code:
1
2
3
4
5
Uncaught TypeError: $(...).autocomplete is not a function(anonymous function) 
@ search.js:2jQuery.Callbacks.fire 
@ jquery.js:3048jQuery.Callbacks.self.fireWith
@ jquery.js:3160jQuery.extend.ready 
@ jquery.js:433completed @ jquery.js:104


Ik heb al wat gezocht op google maar wat ik vind geeft aan dat die functie gewoon zou moeten werken, of ik zie iets over het hoofd.

Alvast bedankt voor de hulp.

Just me


Acties:
  • 0 Henk 'm!

  • XyritZz
  • Registratie: Augustus 2003
  • Laatst online: 06-10 15:09
Zie je iets in je Network tabblad van Chrome? Is het niet zoiets simpels als jQuery UI die een 404 geeft?

I think there is a world market for maybe five computers. - Thomas Watson (1874-1956), Directeur van IBM (1943)


Acties:
  • 0 Henk 'm!

  • Dorgaldir
  • Registratie: September 2009
  • Laatst online: 10-04 22:52

Dorgaldir

Creature of the web

Topicstarter
Afbeeldingslocatie: http://tweakers.net/ext/f/H2riebAneL4IdGKE4UQ9V3hm/thumb.png

Neen die krijgt een 200 terug...

Just me


Acties:
  • 0 Henk 'm!

  • XyritZz
  • Registratie: Augustus 2003
  • Laatst online: 06-10 15:09
En wat gebeurt er als je dit stukje code uitvoert nadat de pagina volledig klaar is met laden?

$("#product").autocomplete({source: "configuration/get_products"});

Als het dan niet dezelfde foutmelding geeft zou het een timing probleem kunnen zijn waarbij de code van search.js al uitgevoerd wordt terwijl jquery ui niet volledig geladen is.

I think there is a world market for maybe five computers. - Thomas Watson (1874-1956), Directeur van IBM (1943)


Acties:
  • 0 Henk 'm!

  • Dorgaldir
  • Registratie: September 2009
  • Laatst online: 10-04 22:52

Dorgaldir

Creature of the web

Topicstarter
ik heb hem helemaal naar de footer gebracht zodat het het laatste is dat ingeladen word en nu werkt het wel, thx :)

Just me