View Complete Thread | FoxWeb Forum Home
Date:    Msg ID:   
From:    Thread:   
Hmmmmm.... I'll try something similar and see what happens.
Joe Bigelow
Sent by FoxWeb Support on 01/17/2003 08:28:54 PM:
I am really confused by your description, but I did manage to get JavaScript code to be generated manually with the method I described.  I created a file called whatever.fwx and placed the following code in it:
alert('The time on the server is <%=TTOC(DATETIME())%>');
The expression within the <%= %> delimiters is evaluated by FoxWeb and the result is used to dynamically create JavaScript code.  Obviously, you can do way more advanced stuff with your FoxWeb and JavaScript code, but this is just an example.
In order to call the above file, simply include the following tag in the output of your script, or in a static HTML file:
<script language="javascript" src="whatever.fwx" type="text/javascript"></script>
Obviously, if the HTML code is going to be generated by a FoxWeb script you don't need to use the src clause.  It would make more sense to generate the JavaScript code in the original script and simply insert it between the <script> tags.

FoxWeb Support Team email

Sent by Joe Bigelow on 01/16/2003 06:20:31 AM:
Nice idea but it doesn't work..., sigh...

The FoxWeb program executes correctly on the server, but nothing happens back on the page. Well, something actually does happen, in the status bar it says "Done, but with errors on page."

I suspect that the "script src" call requires that the stuff processing actually be contained within an external script, not something with javacode returning that the script call is then expected to process because the purpose of the "script src" call is to pass the processing somewhere else and not in the calling web page. Know what I mean? So long as "whatever.js" contains legal javascript commands it works as expected. So, in this case the "whatever.js" appears to be what must make the Foxweb call.

So let me rephrase my query to I suspect be clearer as it being in an external js file or within any body of javascript is I suspect irrelevant. Is there a way to call a FoxWeb program/script from within a legal javascript command? What I think I need to do is stuff a javascript variable, (l_htmlcode),  with the returning text from my fox program, (html code), and then perform the javascript command "document.write(l_htmlcode)". I'd frankly rather write in Fox because I am reading a database with numerous tables to determine what the html code needs to be. But I need to place it in a javascript wrapper to be able to dynamically control sections of various web pages spread across innumerable domains in a sort of affiliate program, (sorta but really not really), by placing that <SCRIPT></SCRIPT> on the necessary pages.

Did I confuse everyone yet?


Joe Bigelow