Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 816987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:55:23+00:00 2026-05-15T01:55:23+00:00

I thought of having an AJAX module service layer, with controllers and actions that

  • 0

I thought of having an AJAX module service layer, with controllers and actions that interact with my model. Easy, but not very extensible and would violate DRY. If I change the logistics of some process I’ll have to edit the AJAX controllers and the normal controllers.

So ideally I would load the exact same actions for both javascript and non-javascript users. I have thought about maybe checking for $_POST['ajax'], if it is set I would load a different (json’y) view for the data. Was wondering how/a good way to do this (front controller plugin I imagine?) or if someone can point me to an UP TO DATE tutorial that describes a really good way for building a larger ajax application.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:55:23+00:00Added an answer on May 15, 2026 at 1:55 am

    You can actually use the request object to determine if a request has happened through ajax, e.g.:

    // from your controller
    if($this->getRequest()->isXmlHttpRequest()) {
        // an ajax request, do something special (e.g. render partial view)
    } else {
       // render entire view
    }
    

    That’s basically testing for the x-requested-with header (which is not always present, depending on JS library, etc). See (under the heading of ‘detecting ajax requests’):

    http://framework.zend.com/manual/en/zend.controller.request.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought this was covered elsewhere but I don't see it now. Anyway, having
Right now the biggest issue I'm having with using AJAX is the fact that
First I thought that I had to convert JavaScript to PHP, but then I
Having read other people's questions I thought window.onload=... would answer my question. I have
I am having problems finding a solution for what I thought would be straight
I'm having difficulty iterating through records while scrolling window. My initial thought was to
I am creating a social bookmarking app. I am having a re-thought of the
I thought I had resolved this but I obviously haven't and was hoping someone
I’m having trouble getting a AJAX/JSON function to work correctly. I had this function
I’m having trouble getting a AJAX/JSON function to work correctly. I had this function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.