This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

grzegorz26070
grzegorz26070

Hello, I'm new here

This is my first project with October. Usually I try to not use jQuery, this time too. All was OK, but now I have one problem. For contact form I create simple plugin, like on this video. Because I not use jQuery I cannot use framework in twig and I haven't many features from system.

I can send form with axios, but how can I handle request in the plugin code? Send data to current url?
Any another headers to send?

X-OCTOBER-REQUEST-HANDLER
X-OCTOBER-REQUEST-PARTIALS
grzegorz26070
grzegorz26070

Found solution.

// method in vue
onSend () {
    const headers = {
        'X-OCTOBER-REQUEST-HANDLER': 'onSend',
        'X-OCTOBER-REQUEST-PARTIALS': '' // this is for update partials only
    }
    const instance = axios.create({
        headers: headers
    })
    instance.post(window.location.href, {var1: 'value'})
}

And in component php file:

 public function onSend() {}

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.