wordpress function through ajax not being called

Based on your comments, I don’t think the MyAjax variable is being localized using wp_localize_script().

In your case, you’ll most likely need something like the following:

wp_localize_script( 'script', 'MyAjax',
    array( 
        'ajaxurl' => admin_url( 'admin-ajax.php' ),
    )
);

That said, I don’t really have enough information to provide a more detailed answer.

EDIT: This and the enqueue scripts call should be inside of the wp_enqueue_scripts callback:

add_action('wp_enqueue_scripts, 'enqueue_my_scripts' );
function enqueue_my_scripts() {

    wp_enqueue_script( 'script', get_template_directory_uri() . '/js/vehicle_parts.js', array ( 'jquery' ), 1.1, true);

    wp_localize_script( 'script', 'MyAjax',
        array( 
            'ajaxurl' => admin_url( 'admin-ajax.php' ),
        )
    );

}