{"action":"created","issue":{"url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/230","repository_url":"https://api.github.com/repos/getgrav/grav-plugin-form","labels_url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/230/labels{/name}","comments_url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/230/comments","events_url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/230/events","html_url":"https://github.com/getgrav/grav-plugin-form/issues/230","id":291314151,"number":230,"title":"Ajax submit 404 error on modular page. ","user":{"login":"martinetoye","id":6633658,"avatar_url":"https://avatars1.githubusercontent.com/u/6633658?v=4","gravatar_id":"","url":"https://api.github.com/users/martinetoye","html_url":"https://github.com/martinetoye","followers_url":"https://api.github.com/users/martinetoye/followers","following_url":"https://api.github.com/users/martinetoye/following{/other_user}","gists_url":"https://api.github.com/users/martinetoye/gists{/gist_id}","starred_url":"https://api.github.com/users/martinetoye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinetoye/subscriptions","organizations_url":"https://api.github.com/users/martinetoye/orgs","repos_url":"https://api.github.com/users/martinetoye/repos","events_url":"https://api.github.com/users/martinetoye/events{/privacy}","received_events_url":"https://api.github.com/users/martinetoye/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-01-24T18:33:06Z","updated_at":"2018-04-23T13:54:26Z","closed_at":null,"author_association":"NONE","body":"Hi\r\n\r\nI am having an issue with submitting a form on a modular page using ajax. I am getting an error 404. \r\nI'm pretty sure its something i'm missing but not sure. Whether it's a template I am missing or a setting I have wrong. \r\n\r\nMy Modular page layout is as follows\r\n\r\n  Home:\r\n       - _banner\r\n       - _about\r\n       - _contact (Where form is placed)\r\n\r\nthe contact.md (also have a twig template to match) file looks as follows.\r\n```\r\n---\r\ntitle: 'Say Hi'\r\nid: contact\r\ncache_enable: false\r\n\r\nform:\r\n    template: form-messages\r\n    refresh_prevention: true\r\n    name: contact-form\r\n    fields:\r\n            - name: name\r\n              label: Name\r\n              placeholder: Enter your name\r\n              autofocus: on\r\n              autocomplete: on\r\n              type: text\r\n              validate:\r\n                required: false\r\n\r\n    buttons:\r\n          submit:\r\n                  - type: submit\r\n                    value: Submit\r\n\r\n    process:\r\n          message: 'Thanks'\r\n---\r\n\r\n<div id=\"form-result\"></div>\r\n\r\n<script>\r\n$(document).ready(function(){\r\n\r\n    var form = $('#contact-form');\r\n    form.submit(function(e) {\r\n        // prevent form submission\r\n        e.preventDefault();\r\n\r\n        // submit the form via Ajax\r\n        $.ajax({\r\n            url: form.attr('action'),\r\n            type: form.attr('method'),\r\n            dataType: 'html',\r\n            data: form.serialize(),\r\n            success: function(result) {\r\n                // Inject the result in the HTML\r\n                $('#form-result').html(result);\r\n            }\r\n        });\r\n    });\r\n});\r\n</script>\r\n```\r\n\r\nAnd the matching twig template \r\n\r\n```\r\n<div id=\"{{ page.header.id }}\">\r\n  <div class=\"container\">\r\n\r\n    <div class=\"row\">\r\n      <div class=\"col-xs-12\">\r\n        <h2>{{ page.header.title }}</h2>\r\n      </div>\r\n    </div><!-- End Row -->\r\n\r\n    <div class=\"row\">\r\n\r\n      <div class=\"col-xs-12 col-md-4\">\r\n        <div class=\"contact__item--wrapper\">\r\n          <div class=\"contact__item\">\r\n            <h3>Email</h3>\r\n            <p>{{ site.owner.email }}</p>\r\n          </div>\r\n        </div>\r\n      </div>\r\n\r\n      <div class=\"col-xs-12 col-md-4\">\r\n        <div class=\"contact__item--wrapper\">\r\n          <div class=\"contact__item\">\r\n            <h3>Phone</h3>\r\n            <p>{{ site.owner.phone }}</p>\r\n          </div>\r\n        </div>\r\n      </div>\r\n\r\n      <div class=\"col-xs-12 col-md-4\">\r\n        <div class=\"contact__item--wrapper\">\r\n          <div class=\"contact__item\">\r\n            <h3>Address</h3>\r\n            <p>{{ site.owner.address }}</p>\r\n          </div>\r\n        </div>\r\n      </div>\r\n\r\n    </div>\r\n\r\n    <div class=\"row\">\r\n\r\n      <div class=\"col-xs-12\">\r\n              {{ page.content }}\r\n            {% include \"forms/form.html.twig\" %}\r\n      </div>\r\n\r\n    </div>\r\n\r\n  </div><!-- End Container -->\r\n</div>\r\n \r\n\r\nIf somebody could point me in the write direction It would be very much appreciated. \r\n\r\nThanks\r\n"},"comment":{"url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/comments/383583544","html_url":"https://github.com/getgrav/grav-plugin-form/issues/230#issuecomment-383583544","issue_url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/230","id":383583544,"user":{"login":"martinetoye","id":6633658,"avatar_url":"https://avatars1.githubusercontent.com/u/6633658?v=4","gravatar_id":"","url":"https://api.github.com/users/martinetoye","html_url":"https://github.com/martinetoye","followers_url":"https://api.github.com/users/martinetoye/followers","following_url":"https://api.github.com/users/martinetoye/following{/other_user}","gists_url":"https://api.github.com/users/martinetoye/gists{/gist_id}","starred_url":"https://api.github.com/users/martinetoye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinetoye/subscriptions","organizations_url":"https://api.github.com/users/martinetoye/orgs","repos_url":"https://api.github.com/users/martinetoye/repos","events_url":"https://api.github.com/users/martinetoye/events{/privacy}","received_events_url":"https://api.github.com/users/martinetoye/received_events","type":"User","site_admin":false},"created_at":"2018-04-23T13:54:26Z","updated_at":"2018-04-23T13:54:26Z","author_association":"NONE","body":"The Only way i sorted was reinstall the form plugin and then it worked."}}
{"actor":{"display_login":"martinetoye"}}