Callign PHP program from Javascript?

3 replies
I have a little php program that reads a database
and creates ads

http://freeheadlinecreator.com/jackads.php

I want to be able to give people a little piece of
javascript code that they can out on any html page
on any domain and put the ads on their page

I tried this but it didn't work:

<script language="JavaScript" type="text/javascript"
src="http://freeheadlinecreator.com/jackads.php">
</script>

Any ideas?

Maybe I need a .js File?


Jack
#callign #javascript #php #program
  • Profile picture of the author michael_gourlay
    You can do this, but the php needs to generate javascript, not html. More specifically, you'll have to generate javascript that will write out the html you need.
    {{ DiscussionBoard.errors[3349999].message }}
  • Profile picture of the author theIMgeek
    To give an example of what Michael is talking about, if your PHP script outputs HTML like this...

    Code:
    <p>Click here for <a href="http://www.mysite.com">My Site</a></p>
    Then it will cause javascript errors. What you need the PHP file to output is more like this...

    Code:
    print ('<p>Click here for <a href="http://www.mysite.com">My Site</a></p>');
    As "print" is the javascript functon to display something on the page. Keep in mind that any apostrophe... ' in your code must be preceded with a backslash... \' or it will cause trouble.

    -Ryan
    Signature
    FREE WSO: Protect and Automatically Deliver Your Digital Products

    Ask the Internet Marketing Geek
    <-- Happy to help with technical challenges
    MiniSiteMaker.org <-- Free software to make your mini-sites fast and easy
    {{ DiscussionBoard.errors[3353056].message }}

Trending Topics