ajax - How can i make full post-back request from angularJS to phalcon php


I have an angularJS + PHP application. What i would like to achieve is a "Full Post" request to Phalcon PHP controller.


$http.post('/controller/sampleAction/', {params}).
   success(function(data, status, headers, config) {

   error(function(data, status, headers, config) {


Phalcon PHP:

public function sampleAction()

    if ($this->request->isPost() == true) {
        // Access POST data
        $this->view->paramA = $this->request->getPost("paramA");
        $this->view->paramB= $this->request->getPost("paramB");

I am getting to phalcon controller, setting my view params but the view is not rendered because its an AJAX request. How can i still use POST function and redirect/render the sampleAction view?




Here are my findings and solution for my problem:

  1. Apparently Phalcon does return the view.

  2. The reason that the view was not rendered as a full post-back response is that Angular is a Single-Page JS framework, so if i want to use it i should build my app accordingly.

  3. So, instead of requesting a full page from Phalcon i changed my architecture, so i will only get relevant Json data from Phalcon while rendering the view purely in angularJS using a directive.




but the view is not rendered because its an AJAX request

False. Unsless you have disabled view by yourself in case of ajax request. Check out your code, share us whats happening inControllerBase::indexAction() and ininitialize() if defined and something related to requests/view.

People are also looking for solutions to the problem: php - Doctrine DBAL Params in WHERE clause


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.