Showing posts with label without refreshing page to change url. Show all posts
Showing posts with label without refreshing page to change url. Show all posts

Monday, April 15, 2013

Controlling access with .htaccess | On form submit to change url in php


Once you submit the button , the url  will change with your search word.  And you encode the url in java-script and add your additional parameters. 


<script>
var url_v      =   $('#searchform').attr("action");
var parameters =   $("#searchingchart").val();
parameters_v   = encodeURIComponent(parameters);
url_v          = url_v + parameters_v   ;
$('#searchform').attr("action",url_v);
</script>

 <form name="form" method="post"  action="/products/"  id="searchform">
 <input type="text"  name="search_val" id="searchingchart" value=""/>
 <input type="submit" id="submit" value="Search"/>
 </form>

In your website url with .(point), you get 404 error . On that time we control the url in .htaccess.

Paste this code in .htacess to get the url has workable.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]


Example URL:
http://www.yoursite.com/products/Max. volume