如何通过jquery将url加载到windows中?

I want to go to url on an element click event, here is my code :

$('#job').click(function() {  
        window.location.href = "<?php echo $this->createUrl('jobs/view');?>";
    });

but the url is loaded as http://mysite/<?php echo $this->createUrl('jobs/view');?> instead of http://mysite/jobs/view, so the php script didn't run, how I can solve this problem ?

Change your filename from yourfile.js to yourfile.php and wrap the whole JS code inside script tag.

You shouldn't have to use PHP to make the URL. Just use

$('#job').click(function() {  
        window.location.href = "/jobs/view";
    });