Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript and PHP!

Status
Not open for further replies.

lutherbach

Programmer
Oct 24, 2001
3
BR
Is it possible to call a php file using a javascript?
Something like a include(example.php).
 
Why would you want to when you can just use an include tag in HTML. You can break apart your JavaScript, even in mid function, and use an HTML include.. you just need to close up the JavaScript correctly. Here's a small example, just in case this is even remotely what you're looking for X-)

Code:
<script Language=&quot;JavaScript&quot;>
<!--
function someFunction() {
  yada yada yada
  yada yada yada
// -->
<!-- #include file=&quot;somejsscript.inc&quot; -->
<!--
  yada yada yada
  yada yada yada
}
// -->
</script>

I use that because I have a single line variable that is used in many, many scripts in my app and there's some ASP involved in creating it. I need to be able to make one change in that variable setting instead of hundreds, so I just did this.

ToddWW :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top