Question: I have several static files. There is no database involved. These files are used for several different purposes. Code snippets, different international languages etc. How do I go about sanitizing input for a search query if the only thing I am doing is something like

```
$searchQuery = $_GET['q'];
$a = 'How are you?';
if (strpos($a, $searchQuery) !== false) {
    echo 'true';
}

```

which is recursively used on each file.

Is sanitization required in this case?

Answer: 
This Type of AJAX Call dataType is not required

Remove 

```
dataType: 'json'

```

Use like

```
<script type="text/javascript">
function gethtml(){
    var url = "<?php echo base_url();?>home/ajax_test";
    alert(""+url);
    $.ajax({
        url: url,
        type: 'POST',
        success: function(data){
            alert("ajax success");
        }
    });
}
</script>

```
You can use below mentioned solution.

```
<button id="btn">ajax Test</button>

$(document).ready(function(){
   $('#btn').Click(function(e){
      e.preventDefault();
      var url = "<?php echo base_url();?>home/ajax_test";           
      alert(""+url);             
      $.ajax({           
            url: url,            
            type: 'POST',               
            dataType: 'json',            
            success: function(data){            
                   alert("ajax success");           
             }      
        });
    });
});

```

Let me know if it not works for you.