Mini Javascript Form Submit

I would like to put a simple form in the header that appears across the board and does something very simple:

  • a textfield

  • a button

When clicking the button take me to mysite.com/xyz

… where xyz is the value entered in the textfield.

your script should be like this


   	$('your-btn').click(function(){

                  url = '<?php Yii::app()->createUrl('url-path');?>';

                  val = $('your-textfield').val();

           		window.location.href = url + "/" + val;

   	});