javascript - $_REQUEST Variable Not Working Online -
i have suggestion search box has 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; or redirect }, success : function(resp) { filter_individual_results();//alert("auto"); }, error : function() { alert("oops, didn't work. please try again."); } }); }); </script>
php
here controller suggestions:
3837: public function suggest_names() { 3838: print_r($this->user_profile_model->suggest_names($_request['term'])); 3839: }
this script working on local pc when run search online not work. keeps on giving me error:
<h4>a php error 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 wondering why works locally not online.
you should use $_get
, parameter being send server via query string. test it, , work fine.
why did work locally , not when installed website online? related way $_request
works, , can numerous reasons being working in local server , not in production server. can find more info here.
Comments
Post a Comment