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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using CF tags in Javascript 1

Status
Not open for further replies.

iao

Programmer
Feb 23, 2001
111
US
Can someone give me a basic understanding of how CF tags in Javascript work? I am trying to understand the flow of how data is requested for a webpage.

For example, when a browser requests a page, the browser makes a request to the web server. The web server loads up the page for the browser. If, there are CFML tags, the web server will first check with the CF server, convert the CFML to HTML and then send the page back to the broswer (something basically like that).

Well, how does this flow change if CF tags are located in Javascript? Will the web server make two requests to the CF server? First, when the Javascript is loaded, and secondly for the HTML? Or, does it all get converted at once.

I don't know if what I am asking makes any sense, but I am just trying to understand how the flow from the web server to the CF server is altered with Javascript, and more importantly, when CF tags are within Javascript.

Thanks!

 
All the CF is "rendered" before the file gets sent to the user. No exeptions :)

This makes it easy to generate JavaScript with CF, but leaves no opportunity for JavaScript to "assign/manipulate" CF variables.

There is a CF/JavaScript app here you may want to peruse.
 
Since the javascript is all on the client's end, and not the server end, I don't understand why this would work without having to make an additonal request. I have looked at Javascript sites, as well as the site you provided. I must be missing something because it still doesn't make sense.

1 - Browser sends request to web server.
2 - Web server searches for CFML
3 - If web server finds CFML, request is made to CF server
4 - CF server returns HTML to web server
5 - Web server returns requested page to browser

After step 5 is completed, I thought that this is where the Javascript comes into play. Is that not true? Because if it is true, how do the CF tags inside of the javascript get "rendered"? Or, in step 2, will the web server also look inside of Javascript for CF tags?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top