i have a question
when a .php file called as a javascript what dose this mean? and when this is needed to be used ?
ex:
<head>
<script src="dir/myphpfile.php" type="text/javascript"></script>
</head>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This means that the
myphpfile.phpwould generate javascript code as output instead of HTML because that’s all that the web browser could understand in ascripttag. It is useful in situations when you want to generate dnyamic javascript at runtime instead of statically coding it in a separate.jsfile. Think for example declaring a javascript variable containing the list of customers stored in a database on the server and making this javascript variable globally accessible.Another common example where this could be useful is to implement JSONP allowing cross domain AJAX requests.
Yet another example is to use a php script that will combine and cache the output of multiple javascript files into one.