AJAX Question

Discussion in 'Javascript' started by KDawg44, Jun 27, 2008.

  1. KDawg44

    KDawg44 Guest

    Hello,

    I am beginning to work on a project for my degree. The concept is
    "The Utilization of AJAX calls to separate the Presentation Layer and
    Application Layer in Web Applications."

    Now, I am developing in PHP as my server side scripting but am try to
    decide how to approach this problem. To adequately support this
    concept, should I have no server side scripting at all on the accessed
    pages? (no php except in the calls by AJAX).

    Another question would be when I get the data back from the call, is
    there a way to pass it into some PHP?

    Thanks, I am at the early stages and am trying to get this kicked
    off.

    Kevin
     
    KDawg44, Jun 27, 2008
    #1
    1. Advertising

  2. On Jun 27, 12:09 pm, KDawg44 <> wrote:
    > Hello,
    >
    > I am beginning to work on a project for my degree. The concept is
    > "The Utilization of AJAX calls to separate the Presentation Layer and
    > Application Layer in Web Applications."
    >
    > Now, I am developing in PHP as my server side scripting but am try to
    > decide how to approach this problem. To adequately support this
    > concept, should I have no server side scripting at all on the accessed
    > pages? (no php except in the calls by AJAX).
    >
    > Another question would be when I get the data back from the call, is
    > there a way to pass it into some PHP?
    >
    > Thanks, I am at the early stages and am trying to get this kicked
    > off.


    It is difficult to design something well without knowing what the goal
    is exactly. I've asked similarly vague questions in here before and,
    to my recollection, there was little discussion. What is the web
    application you are building as your example? Is the objective to
    build this application with a predefined architecture in mind or to
    use whichever architecture best suits the web realities of today? The
    former is a very academic approach while the later is more likely what
    one would need to do to satisfy the widest group of real world users.

    Peter
     
    Peter Michaux, Jun 28, 2008
    #2
    1. Advertising

  3. KDawg44

    KDawg44 Guest

    On Jun 27, 11:58 pm, Peter Michaux <> wrote:
    > On Jun 27, 12:09 pm, KDawg44 <> wrote:
    >
    >
    >
    > > Hello,

    >
    > > I am beginning to work on a project for my degree.  The concept is
    > > "The Utilization of AJAX calls to separate the Presentation Layer and
    > > Application Layer in Web Applications."

    >
    > > Now, I am developing in PHP as my server side scripting but am try to
    > > decide how to approach this problem.  To adequately support this
    > > concept, should I have no server side scripting at all on the accessed
    > > pages? (no php except in the calls by AJAX).

    >
    > > Another question would be when I get the data back from the call, is
    > > there a way to pass it into some PHP?

    >
    > > Thanks, I am at the early stages and am trying to get this kicked
    > > off.

    >
    > It is difficult to design something well without knowing what the goal
    > is exactly. I've asked similarly vague questions in here before and,
    > to my recollection, there was little discussion. What is the web
    > application you are building as your example? Is the objective to
    > build this application with a predefined architecture in mind or to
    > use whichever architecture best suits the web realities of today? The
    > former is a very academic approach while the later is more likely what
    > one would need to do to satisfy the widest group of real world users.
    >
    > Peter


    The application that is the example for the concept is a diet tracking
    system that allows users to input the food/beverages they intake in
    meals and tracks the amount of calories, fat, carbs, vitamins, etc
    that they take in on a daily basis.

    I understand that my questions are vague, as the approach is still a
    little unclear in my head. I am hoping to get feed back on how
    developers feel on the topic. My feeling is that any data
    manipulation or data accessed from the database should be done
    separately and then handed back through an AJAX call to my PHP
    scripts, however, something that is all Presentation related (such as
    echoing the data to the screen using PHP (though that may be a bad
    example due to the fact that this can be achieved with JavaScript).

    Thanks for any suggestions, opinions, or advice.

    Kevin
     
    KDawg44, Jun 29, 2008
    #3
  4. On Jun 29, 2:13 pm, KDawg44 <> wrote:

    [snip]

    > The application that is the example for the concept is a diet tracking
    > system that allows users to input the food/beverages they intake in
    > meals and tracks the amount of calories, fat, carbs, vitamins, etc
    > that they take in on a daily basis.


    This is a basic CRUD-type application and there is no question that
    this can be done without using any client-side scripting. The client-
    side scripting can be used to enhance the user experience when client-
    side feature testing shows that the features needed for the
    enhancements are available. This is a concept called "progressive
    enhancements" (or perhaps better known as but a worse name "graceful
    degradation".)


    > I understand that my questions are vague, as the approach is still a
    > little unclear in my head. I am hoping to get feed back on how
    > developers feel on the topic. My feeling is that any data
    > manipulation or data accessed from the database should be done
    > separately and then handed back through an AJAX call to my PHP
    > scripts, however, something that is all Presentation related (such as
    > echoing the data to the screen using PHP (though that may be a bad
    > example due to the fact that this can be achieved with JavaScript).


    That paragraph is a little unclear to me. I understand you might be
    trying to have all presentation done in the browser and the server
    more-or-less as a data validator and data store. Architecturally, this
    is a nice idea and there are web sites built like this; however, this
    is not really either the intention of how the web was to be used
    (sharing documents) or the way to reach the broadest audience (i.e.
    those with JavaScript disabled or insufficient JavaScript support for
    what your client-side application requires.)

    If you are willing to say "this application only works with Internet
    Explorer 6+, FireFox 2+, Opera 9+, Safari 2+ with images, CSS,
    JavaScript, cookies all enabled and ActiveX enabled on IE6" then you
    can build an application that has presentation performed only on the
    client-side. These requirements are quite restrictive (e.g. thinking
    about some disabled users or users with slightly older cell phones)
    and since this application could be built without any of these
    requirements (i.e. this application could be written to work with IE4,
    Netscape Navigator 4 with JavaScript disabled, for example), then why
    shouldn't it be written that way? Then progressive enhancements can be
    used to make the user experience "slicker."

    If your example was a web-based chat application then perhaps
    requiring JavaScript would be mandatory and the decisions about how to
    design the application would likely be completely different. It
    matters what you are building before you decide how you will build it
    and which technologies will be required for functionality.

    Peter
     
    Peter Michaux, Jun 29, 2008
    #4
  5. KDawg44

    KDawg44 Guest

    On Jun 29, 5:36 pm, Peter Michaux <> wrote:
    > On Jun 29, 2:13 pm, KDawg44 <> wrote:
    >
    > [snip]
    >
    > > The application that is the example for the concept is a diet tracking
    > > system that allows users to input the food/beverages they intake in
    > > meals and tracks the amount of calories, fat, carbs, vitamins, etc
    > > that they take in on a daily basis.

    >
    > This is a basic CRUD-type application and there is no question that
    > this can be done without using any client-side scripting. The client-
    > side scripting can be used to enhance the user experience when client-
    > side feature testing shows that the features needed for the
    > enhancements are available. This is a concept called "progressive
    > enhancements" (or perhaps better known as but a worse name "graceful
    > degradation".)
    >
    > > I understand that my questions are vague, as the approach is still a
    > > little unclear in my head.  I am hoping to get feed back on how
    > > developers feel on the topic.  My feeling is that any data
    > > manipulation or data accessed from the database should be done
    > > separately and then handed back through an AJAX call to my PHP
    > > scripts, however, something that is all Presentation related (such as
    > > echoing the data to the screen using PHP (though that may be a bad
    > > example due to the fact that this can be achieved with JavaScript).

    >
    > That paragraph is a little unclear to me. I understand you might be
    > trying to have all presentation done in the browser and the server
    > more-or-less as a data validator and data store. Architecturally, this
    > is a nice idea and there are web sites built like this; however, this
    > is not really either the intention of how the web was to be used
    > (sharing documents) or the way to reach the broadest audience (i.e.
    > those with JavaScript disabled or insufficient JavaScript support for
    > what your client-side application requires.)
    >
    > If you are willing to say "this application only works with Internet
    > Explorer 6+, FireFox 2+, Opera 9+, Safari 2+ with images, CSS,
    > JavaScript, cookies all enabled and ActiveX enabled on IE6" then you
    > can build an application that has presentation performed only on the
    > client-side. These requirements are quite restrictive (e.g. thinking
    > about some disabled users or users with slightly older cell phones)
    > and since this application could be built without any of these
    > requirements (i.e. this application could be written to work with IE4,
    > Netscape Navigator 4 with JavaScript disabled, for example), then why
    > shouldn't it be written that way? Then progressive enhancements can be
    > used to make the user experience "slicker."
    >
    > If your example was a web-based chat application then perhaps
    > requiring JavaScript would be mandatory and the decisions about how to
    > design the application would likely be completely different. It
    > matters what you are building before you decide how you will build it
    > and which technologies will be required for functionality.
    >
    > Peter


    I understand and appreciate all your points. However, the point of
    this project is to achieve a separation of the layers in the web app,
    making use of AJAX calls.

    Thanks,

    Kevin
     
    KDawg44, Jun 30, 2008
    #5
  6. On Jun 30, 11:23 am, KDawg44 <> wrote:

    [snip]

    > I understand and appreciate all your points. However, the point of
    > this project is to achieve a separation of the layers in the web app,
    > making use of AJAX calls.


    That is fine as those restrictions are justified up front and
    potential costs and/or benefits to business are acknowledged. Benefits
    include speed of development.

    Building such an application is pretty easy. Start with a document
    with an empty body like this


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Diet Tracking App</title>
    <link href="/css/app.css" rel="stylesheet" type="text/css">
    <script src="/js/app.js" type="text/javascript"></script>
    </head>
    <body>
    </body>
    </html>

    Use XMLHttpRequest with JSON for all communication with the server.
    You might want to use an MVC-like framework for the client-side code.

    Good luck.

    Peter
     
    Peter Michaux, Jun 30, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    20
    Views:
    1,912
    d1srupt3r
    Mar 31, 2008
  2. darrel

    beginner AJAX questions (AJAX.net)

    darrel, Apr 27, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    2,445
    Flinky Wisty Pomm
    Apr 28, 2006
  3. jobs
    Replies:
    0
    Views:
    371
  4. =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?=

    Deploying ASP.NET AJAX-Enabled Web site to host without AJAX insta

    =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?=, Feb 20, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    607
    Patrick
    Feb 21, 2007
  5. minnie
    Replies:
    1
    Views:
    720
    Andrew Thompson
    Dec 13, 2006
Loading...

Share This Page