AJAX or Frames: Which Do You Recommend and Why?

6 replies
The title of this thread pretty much says it all but let me give a little background behind the question.

I'm having a web-based tool built for IMer's. The developer I was going to use to build the layout of the tool just informed me that he was going to build the whole thing using frames. I was talking to another developer and he said I should be using AJAX. So I went to my developer and told him I want to build it in AJAX. The problem is, he doesn't know AJAX.

Do I fire my developer and find one that knows AJAX or doesn't it really matter? I'm not a technical person so I have no clue what the differences are to determine if one is better than another. I need you warrior developers help on this!

Thanks,

Travis
#ajax #frames #recommend
  • Profile picture of the author wayfarer
    AJAX and frames can do some of the same or similar things, but it really depends on on what your purpose is. For general use, frames are not recommended because the content in them becomes orphaned in search engines, since each frame is in fact a separate page altogether. However, content generated with AJAX is even less accessible, since anything updated with JavaScript is completely ignored by search spiders. Not that any of this matters much when it comes to web applications.

    A frame can do some things that an AJAX (xmlHTTP request object) cannot, such as point at a remote website. This is not to say these two thing are in the same category, because they truly are not. AJAX calls can make complex requests to the server, then return any type of information to update an existing page. If you need an application that relies on a series of calls between the browser and server without a page refresh, AJAX is what you should be using.

    There are some things that can't be transmitted with an xmlHTTP request, however, such as files. If you want an "AJAX upload" where files are submitted without refreshing the page, you won't in fact use AJAX, but will target an invisible frame:
    HTML Code:
    <form action="page-to-upload-to.php" method="post" enctype="multipart/form-data" target="my-iframe-name">
         <input type="file" name="myfile" />
         <input type="submit" value="Send it!" />
    </form>
    <iframe style="display: none" src="page-to-upload-to.php" name="my-iframe-name"></iframe>
    The other big thing, as I pointed out previously, is that AJAX calls can never read anything that does not reside on the same server as the script making the call. This is an important limitation for security reasons. An IFRAME can at least display a page residing on a remote website, though you still can't read any information inside it (with JavaScript) once a remote page is loaded.
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[1236463].message }}
    • Thanks for the info but I think I'm more confused now...lol. Let me try to briefly explain what this tool does and then maybe you can just tell me to use AJAX or frames because that's really all I want to know.

      This tool is similar to a home search tool.

      On the left side of the page there are various search criteria. For example, you can select # of bedrooms, # of bathrooms, year built of home, etc. etc. Then on the right side of the page your results are returned. Then below those results is yet another "section" where you can filter those results. So let's say after you get your initial search results, you only want to see homes with 3 bedrooms. You'd make that selection and then the results would change accordingly.

      Essentially the page would have 3 "frames." One frame would contain the initial search criteria, another frame would contain the search results, and another frame would have the filtering criteria. Ideally, you'd only want the search results frame to refresh, or change, as you select different search and filter criteria.

      My developer is telling me that there will be little difference between frames and AJAX in terms of performance and usability. I don't know if he's telling me this because he doesn't know AJAX and he wants the job or if he's telling me the truth.

      Thanks,

      Travis

      Originally Posted by wayfarer View Post

      AJAX and frames can do some of the same or similar things, but it really depends on on what your purpose is. For general use, frames are not recommended because the content in them becomes orphaned in search engines, since each frame is in fact a separate page altogether. However, content generated with AJAX is even less accessible, since anything updated with JavaScript is completely ignored by search spiders. Not that any of this matters much when it comes to web applications.

      A frame can do some things that an AJAX (xmlHTTP request object) cannot, such as point at a remote website. This is not to say these two thing are in the same category, because they truly are not. AJAX calls can make complex requests to the server, then return any type of information to update an existing page. If you need an application that relies on a series of calls between the browser and server without a page refresh, AJAX is what you should be using.

      There are some things that can't be transmitted with an xmlHTTP request, however, such as files. If you want an "AJAX upload" where files are submitted without refreshing the page, you won't in fact use AJAX, but will target an invisible frame:
      HTML Code:
      <form action="page-to-upload-to.php" method="post" enctype="multipart/form-data" target="my-iframe-name">
           <input type="file" name="myfile" />
           <input type="submit" value="Send it!" />
      </form>
      <iframe style="display: none" src="page-to-upload-to.php" name="my-iframe-name"></iframe>
      The other big thing, as I pointed out previously, is that AJAX calls can never read anything that does not reside on the same server as the script making the call. This is an important limitation for security reasons. An IFRAME can at least display a page residing on a remote website, though you still can't read any information inside it (with JavaScript) once a remote page is loaded.
      Signature
      TVS Internet Marketing: Helping small businesses get more visibility & sales online.
      {{ DiscussionBoard.errors[1236518].message }}
  • Profile picture of the author wayfarer
    I can see how either technique could be used for what you're describing. However, AJAX would be my preferred solution. Frames seem much more awkward and limiting to me. The technical explanation is that it is much harder to write a callback that knows when a frame has been updated with content, so that you can proceed to the next phase of logic.

    I'm not sure I would trust a developer to build something like this that doesn't know anything about AJAX. However, if the developer can point to something in his or her portfolio that has been successfully built and is a related concept, building with frames will be just fine.

    You might suggest that the developer learn a common JavaScript framework, like jQuery. AJAX calls are a piece of cake with a framework.
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[1236614].message }}
    • Thanks. That's what I was afraid of. I really like this developer as he's done other work for me but I think I need to find another developer for this that can code using AJAX. This isn't going to be a cheap tool to build so if I'm going to do this, I might as well do it the right way and AJAX seems like the better solution.

      Travis

      Originally Posted by wayfarer View Post

      I can see how either technique could be used for what you're describing. However, AJAX would be my preferred solution. Frames seem much more awkward and limiting to me. The technical explanation is that it is much harder to write a callback that knows when a frame has been updated with content, so that you can proceed to the next phase of logic.

      I'm not sure I would trust a developer to build something like this that doesn't know anything about AJAX. However, if the developer can point to something in his or her portfolio that has been successfully built and is a related concept, building with frames will be just fine.

      You might suggest that the developer learn a common JavaScript framework, like jQuery. AJAX calls are a piece of cake with a framework.
      Signature
      TVS Internet Marketing: Helping small businesses get more visibility & sales online.
      {{ DiscussionBoard.errors[1236636].message }}
  • Profile picture of the author wayfarer
    It's always nice to have developers of different skillsets around. Look for someone who calls themselves a "client side programmer" or "front-end developer" but who also knows how to do some server programming.
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[1236643].message }}
  • Profile picture of the author mywebwork
    Hi Travis

    I agree with wayfarer, AJAX is the preferable route to go. It gives you the opportunity to design a fluid Web 2.0 type interface for your application.

    A design based solely upon frames (and it should be noted that even an AJAX based design may contain an iframe) would certainly be functional for your application, at least based upon what details you've shared about it, but would be limited in the number of features you could offer.

    Since frame-based designs are essentially a collection of web pages it can be challenging to control one frame from within another, thus it is difficult to incorporate sophisticated controls in the design. AJAX designs are just one page, a page whose DOM (Document Object Model) can be manipulated dynamically. In English this means that you can change the page contents without refreshing the page! See Google Maps for one of the best examples of AJAX in use.

    Technically there are pluses and minuses in both camps - a frames-based design is simpler to implement and won't break if the user disables JavaScript. But in the real world I think you'll find very few people who disable JavaScript.

    Let me know if you need any assistance with this.

    Bill
    {{ DiscussionBoard.errors[1236958].message }}

Trending Topics