Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    11
    Rep Power
    0
    so you dont want to have to update every page??? well, why not make a .js file, and just have the src="" point to the .js file??? it is exactly the same, and much less complicated.

    your something.js file would just be like this (no perl code, nothing extra, just pure javascript)

    PHP Code:
    document.writeln('stuff');
    document.writeln('blah'); 
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Posts
    1,014
    Rep Power
    15
    well, why not make a .js file, and just have the src="" point to the .js file??? it is exactly the same, and much less complicated.
    I couldn't agree more.

    This thread started with the question whether it was possible to execute Perl from JavaScript, and how to do that...

    [And a final word: the call to your ad server returns an image. So the url of the ad server should be the href attribute of an img tag, not the src of a javascript tag:
    document.write ('<img src="http://theurl">')

    Jeroen
  4. #18
  5. 'fie' on me, allege-dly
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2003
    Location
    in da kitchen ...
    Posts
    12,889
    Rep Power
    6444
    Ladies & Gentlemen,

    There's a time and a place for everything. Why put load on a server when you don't have to. You have a 'fairly static' HTML page, but you want to update certain coords with news, lotto results, advertising ... whatever.

    This process allows the server to do only what is asked of it.

    Yes I know it can be done a million other ways, but it works. It allows the javascript to be updated as a responsibility of the server rather than the client.

    You could have a Perl script write the javascript, and the HTML call the JS, picking up the latest version, but that too has its problems

    Ax
  6. #19
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    77
    Rep Power
    12
    hi,

    thanks for that..but now im sort of confused....which type of prgramming will put the most strain on a server...such as php, cgi (perl), asp etc....in other words what is the best prgram to use that wont strain the server as much?? and how do i do the javascript (.js) script...is it just as you said..in a notepad..then upload to the server...and i need to chmod it??

    thanks.
  8. #20
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    77
    Rep Power
    12
    Originally posted by Axweildr
    If there's a syntax error in your javascript it won't work

    You should see the 'warning' icon in the bottom left on the status bar, if there's an error in the javascript.

    Test your javascript in isolation before wrapping it. It can be a nightmare to debug, but well worth it

    HTH
    Ax
    No theres no javascript error, it jsut doesnt display the banner at all....and its not like a image thats remotely hosted on my server, the javascript for the ad code is from third party advertising, but it doesnt display the banner at all when i i run the page with the <script type="text/javascript" src="pathtoyour.cgi"></script>
    script on it (and yes i have edited it to point to the script on my server!!)

    wonder why it wont work...the .js one i tried displays the banner fine with no problems....??

    please help!!
  10. #21
  11. 'fie' on me, allege-dly
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2003
    Location
    in da kitchen ...
    Posts
    12,889
    Rep Power
    6444
    Put
    print "Content-Type: text/html\n\n";

    At the top of your script. This is required on Apache, but not required on Xitami.

    Look in your temporary internet files for the javascript snippet, and see if its printing what you're expecting, it should be called ads.cgi or ads[1]

    HTH
    Ax
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo