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>

```
Error in the above code is the response from the ajax\_test() is not encoded into json. So, the error event of json is triggered and the code inside success is not executed. 
Always make sure to send json encoded data if you are specifying dataType as json.