十月CMS-Ajax URL? [英] October CMS - Ajax URL?

查看:101
本文介绍了十月CMS-Ajax URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对十月CMS使用Angular JS.但是我如何将数据发布到控制器?

I want to use Angular JS for October CMS. But how to i POST data to the controllers?

我在十月framework.js文件中找到了

I found this in the October framework.js file

headers: {
    'X-OCTOBER-REQUEST-HANDLER': handler,
    'X-OCTOBER-REQUEST-PARTIALS': this.extractPartials(options.update)
},

但是我很难调试它.

此发布到的URL是什么?以及我将如何使用this.extractPartials(options.update)

What is the URL this posts to? And how would i use this.extractPartials(options.update)

推荐答案

但是我对JS框架了解不多,我认为October的标准响应数据是html呈现的,并且脚本/样式由框架注入.相反,您应该创建自己的路线并返回适当的响应.

I don't know much about JS frameworks however, I think Octobers standard response data is rendered html and scripts/styles to be injected by the framework. Instead you should create your own Routes and return the appropriate response.

例如:

# Author/Plugin/Plugin.php

public function onBoot() {
    Route::get('ajax/endpoint', function() { return Post::all() });
});

这篇关于十月CMS-Ajax URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆