Ajax form action not triggered in Sails.js

依然范特西╮ 提交于 2020-03-04 19:38:09

问题


I created an action in Sails.js to create an entry in a database (add a customer). Then I created a form in EJS. (My code is based on the signup route / form)

I have my Customer.js models

I have my view-create-customer.js

I have my create-customer.page.js

I have my controller "action" create-customer.js

cloud.setup.js has "createCustomer":{"verb":"POST","url":"/api/v1/entrance/create-customer","args":["customerName","status"]}

In routes.js I have :

'POST /api/v1/entrance/create-customer': { action: 'entrance/create-customer' },

The ajax-form in my EJS Form I have :

<ajax-form action="createCustomer" :syncing.sync="syncing" :cloud-error.sync="cloudError" @submitted="submittedForm()" :handle-parsing="handleParsingForm">

The form displays just fine, but nothing happens when I click submit. No error, no ajax triggered.

I tried to POST to the API url with POSTMAN and my customer was created as expected.

Any idea ?

来源:https://stackoverflow.com/questions/60284005/ajax-form-action-not-triggered-in-sails-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!