问题
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