House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Search ajax

July 04, 2009

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Home /  Groups /  Ajax

iframe vs XMLHTTP

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Adam Haskell
05/10/2005 09:50 AM

Ik now most people use xmlhttp but I want some reason why to use this over just using n Iframe...I am looking for solid explanations not just..you have better control...how is that I have better control? Adam H

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob
05/10/2005 12:37 PM

That's a pretty good question. I would say the main reason is that iframe is a hack, where xmlhttprequest was made for doing what it does. You can get status codes from the request (i.e. 404, 500s) You can get the http headers out of the request - and set them as well. You can do the process in a separate "thread" (asynchronous) ... I can't do to many more or my presentation at the portland UG wont have much content :-D > Ik now most people use xmlhttp but I want some reason why to use this > over just using n Iframe...I am looking for solid explanations not > just..you have better control...how is that I have better control? > > Adam H

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Marlon Moyer
05/10/2005 12:37 PM

The one benefit I've seen is that you get a ready state change.  It ranges from  0~4 with 4 being completed.  Even if your called function errors out, you'll still get a completed readystate. > Ik now most people use xmlhttp but I want some reason why to use this > over just using n Iframe...I am looking for solid explanations not > just..you have better control...how is that I have better control? > > Adam H

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Marlon Moyer
05/10/2005 12:40 PM

If you're wanting to play around with xmlhttp calls, I would suggest using the Sarissa project from sourceforge. > Ik now most people use xmlhttp but I want some reason why to use this > over just using n Iframe...I am looking for solid explanations not > just..you have better control...how is that I have better control? > > Adam H

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Marc Campeau
05/10/2005 12:41 PM

I have used both and you can achieve similar results with both. I prefer to use xmlHttp if I am expecting a result back from a call, that way I don't have to pass a callback function name in the IFrame call to tie both windows together upon return from the request. I've used Iframes when the app doesn't care about the result of the call or at least it's not expecting data to be returned from the call. Marc > Ik now most people use xmlhttp but I want some reason why to use this > over just using n Iframe...I am looking for solid explanations not > just..you have better control...how is that I have better control? > > Adam H

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Steve Brownlee
05/10/2005 12:15 PM

Apples and oranges, Adam. An XMLHTTP request/response model is a transaction wherein you request another page via HTTP, receive a response, check that response for success or failure and then do XYZ with the data received via Javascript (sometimes very complex Javascript). An IFRAME is simply an inline frame that you can specify as a target for links. ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob
05/10/2005 01:02 PM

There is a technique to load xml (or other types of data) via an iframe though, and I think that's what he meant. Thats how http://www.pengoworks.com/index.cfm?action=articles:gatewayApi that used to (or does) work ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Thomas Chiverton
05/12/2005 08:40 AM

> iframe though, and I think that's what he meant. Thats how > http://www.pengoworks.com/index.cfm?action=articles:gatewayApi that > used to (or does) work Yeah, the problem there is that it is single threaded - if you have a request prossing through Gateway, and the user clicks another button you have to manage the 'wait till current request completes', which rapidly becomes a queue. We're finding the Gateway a big bottle neck for that reason. I'm not sure XMLHTTP would fix this, as it then becomes a problem of maintaining state if the 2nd action assumes a consistant state, but action 1 is still changing things (or waiting on the request). -- Tom Chiverton Advanced ColdFusion Programmer

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob
05/12/2005 11:47 AM

----- Excess quoted text cut - see Original Post for more ----- Yeah, at that point it's more of how you design the application to function - there are ways of doing it so you minimize things, but once you start multi threading the UI you can get some odd things going on - especially if you're not used to multi threaded apps, and double so with JS where you have no built in synchronize type mechinizim. However, you can still pull it off with XMLHTTP and you cant with iframe (unless you have several iframes I suppose...) -- ~Blog~ http://www.robrohan.com ~The cfml plug-in for eclipse~ http://cfeclipse.tigris.org ~open source xslt IDE~ http://treebeard.sourceforge.net

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Adam Haskell
05/10/2005 01:07 PM

No not apples and oragnes..I can do most of that with an Iframe...hidden Iframe and it is a standard unlike XMLHTTP.... ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Adam Haskell
05/10/2005 01:13 PM

Good answers so far...I've only reacently used XMLHTTP and it was in a kix script so I am still learning about it, I've used iframes in webpages to do these tasks for a while though. Only problem now is that people in my work place say XMLHTTP is better but they don't use any of the state bonuses for xmlhttp...just donig what I did with an iframe a few years ago...heh. Adam H ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Robyn
05/10/2005 01:26 PM

I've just started playing in the AJAX world, and used to do most of this kind of stuff through IFrames.  I can tell you that AJAX is so, so much easier than using IFrames.  It doesn't have to be a lot of code, and it's *much* easier to manage.  That said, it does mean that you need to know a bit about how how HTTP protocol to get around. -Robyn Adam Haskell wrote: ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists