How to add php within jquery

I see no reason for you to use PHP in your JavaScript file. Enqueue your script properly using the wp_enqueue_scripts hook and then use the wp_localize_script()function to pass your data to your JavaScript code.

<?php
function wpa67325_enqueue_scripts() {
    wp_enqueue_script( 'some_handle', 'filename.js', false );
    $translation_array = array( 'some_string' => __( 'Some string to translate' ), 'a_value' => '10' );
    wp_localize_script( 'some_handle', 'object_name', $translation_array );
}

add_action( 'wp_enqueue_scripts', 'wpa67325_enqueue_scripts', 10 );