Use php var in javascript file fault [duplicate]-Collection of common programming errors

I have a question about using a php variable in my javascript file. This is my index.php file:


    
        
            
                
                


window.jQuery || document.write('')

As you can see I check if an appid is sent. When I received it I load data from an api. In the bottom of the page I have a link to my javascript file. (.php because I want to use the php var $ array in my js file)

My main.js.php:

$(document).ready(function() {
    var data = ;
    alert(data);
});

But I got always error in console:

Uncaught SyntaxError: Unexpected token

Originally posted 2013-11-13 09:48:57.