CodeIgniter Forums
jQuery UI Autocomplete with CI ?? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: jQuery UI Autocomplete with CI ?? (/showthread.php?tid=30052)

Pages: 1 2 3 4 5 6


jQuery UI Autocomplete with CI ?? - El Forum - 04-30-2010

[eluser]seanloving[/eluser]
Does anybody know how to setup the jQuery UI Autocomplete for use with Codeigniter?

I see that the jQuery plugin on the wiki has a solution for the older jquery.autocomplete.js, but I wonder what is the trick to integrate jquery.ui.autocomplete.js with CI ??

Yes I got jQuery UI working with local data, as in this example

But how do I make jQuery UI work with remote data, like in this other example?


Thanks
Sean Loving


jQuery UI Autocomplete with CI ?? - El Forum - 05-01-2010

[eluser]Mareshal[/eluser]
Same as first example.

If you look inside the source of the 2nd example you find this code:

Code:
$("#birds").autocomplete({
            // TODO doesn't work when loaded from /demos/#autocomplete|remote
            source: "search.php",
            minLength: 2,
            select: function(event, ui) {
                log(ui.item ? ("Selected: " + ui.item.value + " aka " + ui.item.id) : "Nothing selected, input was " + this.value);
            }
        });

Source file is search.php, so the autocomplete sends a request to search.php and it returns some data with echo.

You could call this directly like: search.php?q=test


jQuery UI Autocomplete with CI ?? - El Forum - 05-01-2010

[eluser]technovicebd[/eluser]
I have also applied jquery autocomplete in my one of my project, check it out:
http://sirki3.com/compareprice ..try to write something in search box. If that's gonna work for you, then I can speak up.


thanks


jQuery UI Autocomplete with CI ?? - El Forum - 05-01-2010

[eluser]Mareshal[/eluser]
What should I get? is a complete mess in your code.


jQuery UI Autocomplete with CI ?? - El Forum - 05-01-2010

[eluser]technovicebd[/eluser]
Excuse me Mr Mareshal, I think you are not the owner of the post. How do you know my code is a complete mess??Are u insane? Think twice before replying any post. It will be good for everyone not to waste time.


jQuery UI Autocomplete with CI ?? - El Forum - 05-01-2010

[eluser]seanloving[/eluser]
[quote author="Mareshal" date="1272724064"]
Source file is search.php, so the autocomplete sends a request to search.php and it returns some data with echo.

You could call this directly like: search.php?q=test[/quote]

@Mareshal- do you mean change the javascript from
Code:
..
source: search.php,
..
to something else?


jQuery UI Autocomplete with CI ?? - El Forum - 05-01-2010

[eluser]seanloving[/eluser]
[quote author="technovicebd" date="1272727281"]I have also applied jquery autocomplete in my one of my project, check it out:
http://sirki3.com/compareprice ..try to write something in search box. If that's gonna work for you, then I can speak up.


thanks[/quote]

@technovicebd-
Although what you have gives the type of functionality I'm looking for by using jquery.autocomplete.js, my question was about how to use the newer jquery.ui.autocomplete.js

Thanks
Sean Loving


jQuery UI Autocomplete with CI ?? - El Forum - 05-01-2010

[eluser]Mareshal[/eluser]
[quote author="technovicebd" date="1272730559"]Excuse me Mr Mareshal, I think you are not the owner of the post. How do you know my code is a complete mess??Are u insane? Think twice before replying any post. It will be good for everyone not to waste time.[/quote]

1. Your code doesn't have proper indentation
2. Your code uses too many style="" instead of classes or IDs.
3. You include javascript in the entire code
4. your admin panel is a complete mess.

Before replying to me, think twice.

@seanloving: yes, change search.php to your search path,


jQuery UI Autocomplete with CI ?? - El Forum - 05-01-2010

[eluser]technovicebd[/eluser]
@Mr Mareshal: R u bill gates here to judge my coding?? stupidity should have a limit. oil your own machine Mr New Bill Gates.


jQuery UI Autocomplete with CI ?? - El Forum - 05-01-2010

[eluser]seanloving[/eluser]
[quote author="Mareshal" date="1272748413"]
@seanloving: yes, change search.php to your search path,[/quote]

when I use source: availableTags everything works fine. But when I use source: "http://localhost/sample.com/search" it does not work.

Code:
<s-cript type="text/javascript" src="&lt;?php echo base_url()."assets/js/jquery-1.4.2.min.js" ?&gt;">[removed]
    <s-cript type="text/javascript" src="&lt;?php echo base_url()."assets/js/jquery.ui.core.js" ?&gt;">[removed]
    <s-cript type="text/javascript" src="&lt;?php echo base_url()."assets/js/jquery.ui.widget.js" ?&gt;">[removed]
    <s-cript type="text/javascript" src="&lt;?php echo base_url()."assets/js/jquery.ui.position.js" ?&gt;">[removed]
    <s-cript type="text/javascript" src="&lt;?php echo base_url()."assets/js/jquery.ui.datepicker.js" ?&gt;">[removed]
    <s-cript type="text/javascript" src="&lt;?php echo base_url()."assets/js/jquery.ui.autocomplete.js" ?&gt;">[removed]
    var availableTags = ["PT-042-GP", "PT-042-TP", "PT-042-JP", "PT-042-RP", "PT-042-WP", "PT-042L-GP", "PT-042L-TP"];
    $(".product_picker").autocomplete({
        //source: availableTags,
        source: "http://localhost/sample.com/search",
        minLength: 1,
        select: function(event, ui) {
            log(ui.item ? ("Selected: " + ui.item.value + " aka " + ui.item.id) : "Nothing selected, input was " + this.value);
        }
    });

The file search.php is located in my application/controllers/ and I am thinking this is in fact correct.

Not sure if I need the jQuery AJAX helper and hook for CI in order to make this work with "remote data".

My ultimate goal is to autocomplete from MySQL database.