No announcement yet.

MvDO VS AJAX scenario...

  • Filter
  • Time
  • Show
Clear All
new posts

    MvDO VS AJAX scenario...

    First - this is not related to anything Miva Merchant.

    - I have an mvc page that loads.
    - This page has an average of 3 MvDo's
    - Each of the MvDo's contain at least one MvCall

    Is it better to keep it this way or
    - Replace the MvDo's with Ajax calls?

    My first thought is that using Ajax means the MvCalls can run while the initial page continues to load
    - Is this assumption correct?
    - Which scenario is a bigger load on the server?

    Or - is a websocket potentially better?
    - There is no need to continuous communication, so I am fairly sure this is not a good answer.

    William Gilligan - Orange Marmalade, Inc.

    I reserve ajax for interactions with the user after the page has loaded - click this, do something, display the results, etc....

    When I'm gathering remote data to display during an initial page load, mvcall is my first choice because that's all I'm doing- gathering the data to get it ready for display and since there's no interaction with the user until the page is displayed, there's no need for ajax. I suppose if there was an API that you couldn't get in via MvCALL ajax might be an option, but I haven't hit an endpoint I can't MvCALL yet.

    Another consideration would be if some endpoint your MvCALLing is super slow and the page has to wait a long time to load, that's no good, so in that case I might load the page and leave a space for the data, put a spinner in or something. In fact, I do just that on where I load the page and at the top there's a framework for some weather data (snow fall, temp, etc..) I ajax that info in because I'm reading some csv files that get updated once an hour (cron call to a small mvc that uses mvcall) and don't want to take a chance that they will slow the rest of the page load down.
    M.A.D.* since 1997

    *miva application developers


      I second what Scot says (if that matters :) )
      Bruce Golub
      Phosphor Media - "Your Success is our Business"

      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook