×

Welcome to TagMyCode

Please login or create account to add a snippet.
2
0
 
0
Language: Javascript
Posted by: Jan WebDev WebDev
Added: Jul 12, 2012 3:31 PM
Modified: Jul 12, 2012 3:33 PM
Views: 66
Jquery form submit
  1. $(document).ready(function(){
  2.             $('#search').submit(function(e){
  3.               e.preventDefault();
  4.               var query = urlencode($.trim($(this).find('input[name=search]').val()));
  5.               if(query){
  6.                 location.href = $(this).attr('action')+'/'+query.replace('%2F','%252F');
  7.               }
  8.             });
  9.           });