Include remote file using JS

Discussion in 'Programming' started by nickjason, Mar 11, 2010.

  1. #1
    I would like to be able to serve content to my clients' websites, using javascript.

    The content I would like to serve is generated from PHP on my server.

    I've seen people do this using code like this, that is placed on the client site:

    <script type="text/javascript" language="javascript" src="http://www.mydomain.com/page.php?id=15&amp;id=123456">

    What do I need to have on my server in order for the content to be displayed on their site?
     
    nickjason, Mar 11, 2010 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    page.php?id=15&amp;id=123456 just needs to generate a .js file - send the correct header for JS, and make sure you start and end with js script tags
     
    ccoonen, Mar 11, 2010 IP
  3. nickjason

    nickjason Peon

    Messages:
    414
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ohh i got what i missed. thanks .
     
    nickjason, Mar 12, 2010 IP