javascript - 403 Access Forbidden when directly accessing a page using base_url() -


i'm getting 403 error when trying access page via xhr :

$("form").submit(function( event ) {   xmlhttp.open("get","<?=base_url('application/views/pages/search_sql.php'); ?>",true);   xmlhttp.send();    event.preventdefault(); }); 

i load page search_sql.php straightforward xmlhttp.open("get","search_sql",true); doesn't load script directly - instead handled controller , loaded other views unwanted in case.

you using codeigniter why trying load directly?

call page , add controller method required in situation. so:

assuming have controller called 'search' create method called relevant lets 'special_case' , call parameters requires so

<?php  class search extends controller {      function index()     {         // assume doing     }      function special_case()     {         // make whatever required in case.     } 

then call javascript using standard codeigniter controller/method/param1/param2 ...... mechanism.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -