MVC: how to ajax?

前端 未结 6 801
我在风中等你
我在风中等你 2021-02-03 14:01

I\'m going to start a project using a Zend Framework MVC implementation.

How do I work with ajax? I mean, should I place all ajax code into controller? Or into view?

6条回答
  •  盖世英雄少女心
    2021-02-03 14:19

    When i use ajax with codeigniter i output straight out of the controller.

    I also use seperate controller for simple ajax requests like flagging, favorites, etc. For ajax requests like login, contact, etc i would add logic to the normal path(eg. domain.com/contact) do deal with an ajax request. I then output json and kill script execution.

提交回复
热议问题