I have a suggestion search box which has the following code:
HTML
<input style="margin-right: 10px;height: 21px;" type="text"
placeholder="Persons First Name" name="individual_name" id="individual_name"
onfocus="clearField(this, this.placeholder)"
onkeyup="filter_individual_results()"/>
JavaScript
<script>
$(function() {
$( "#individual_name" ).autocomplete({
source: "<?php echo base_url(); ?>frontend_individual/suggest_names",
minLength : 3,
select: function( event, ui ) {
//$('#ui-id'+i).click(filter_individual_results());
update_input_box('individual_name',ui.item.value,'2');
//alert('id :'+ui.item.value) ;
//document.location.href = base_url+"controller_name/search?keyword="+ui.item.value; do something or redirect
},
success : function(resp) {
filter_individual_results();//alert("auto");
},
error : function() {
alert("Oops, that didn't work. Please try again.");
}
});
});
</script>
PHP
Here is the controller for suggestions:
3837: public function suggest_names() {
3838: print_r($this->user_profile_model->suggest_names($_REQUEST['term']));
3839: }
This script is working perfectly on my local PC but when I run this search online it does not work. It keeps on giving me this error:
<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Undefined index: term</p>
<p>Filename: controllers/frontend_individual.php</p>
<p>Line Number: 3838</p>
I am wondering why it works locally but not online.