• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[ASK] Integrating CI and Jquery autocomplete plugin

#11
[eluser]slowgary[/eluser]
You'll probably need to post your code Mikey.

#12
[eluser]mikeyhell[/eluser]
Copied from above ... I basically just added in that type:"post" but it won't pick up the post variable ... stays as get... not sure why it won't change but I checked on jquery forums and they said the same thing ... just add that param in and it should just work:

Code:
$.ajax({type: "post",
        mode: "abort",
    port: "autocomplete" + input.name,
    dataType: options.dataType,
    url: options.url,
    data: $.extend({
    q: lastWord(term),
    limit: options.max
    }, extraParams),
    success: function(data) {
    var parsed = options.parse && options.parse(data) || parse(data);
               cache.add(term, parsed);
             success(term, parsed);
                }
});

From my view:
Code:
$(document).ready(function(){
    $("#client_name").autocomplete("<?php echo base_url() ?>ajax/customers", {
        scroll: true,
        scrollHeight: 300,
        autoFill: true,
        cacheLength: 1,
        min: 1,
        max: 20,
        matchContains: false,
        onItemSelect:selectItem, selectOnly:1, elementID:'cust_id'
    });
});

#13
[eluser]slowgary[/eluser]
I'm not sure. You said you were getting an error. What gave the error? What file was it in? Did it give you a line number?

#14
[eluser]mikeyhell[/eluser]
I got it worked out. I switched to the segment based autocomplete described in this thread:

Segment Based Jquery Autocomplete

I initially had some troubles with that on my local server but once I committed to my dev server everything seemed to work fine so I'm pretty sure that is the same issue I was having here. Not sure what the deal was though b/c I'm running a vm image of my dev server. Thanks anyways though.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.