Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
POST request on form submit ember.js

I am totally green in Ember.JS. I’ve made simple adoption shelter application with Ember tutorials as I am using ember on front end, and Strapi (Node.JS) as an Headless CMS. I have all the endpoints and my ember front is successfully fetching data with GET method via JavaScript’s fetch. However, I want to allow users to create POST requests based on form submit, I can’t find any good example or tutorial how to properly make an post request on form submit in ember.js, could you please help me with figuring out how to do this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Using:

  • https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
  • https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
  • https://developer.mozilla.org/en-US/docs/Web/API/FormData
  • https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/formdata_event
  • https://developer.mozilla.org/en-US/docs/Web/API/SubmitEvent
  • https://guides.emberjs.com/release/components/template-lifecycle-dom-and-modifiers/#toc_event-handlers

I think you could submit a form via:

ember g component my-form -gc

And then in that component

// app/components/my-form.js
import Component from '@glimmer/component';

export default class MyForm extends Component {

  submit = async (event) => {
    event.preventDefault();

    let data = new FormData(event.target);

    await fetch('your url', {
      method: 'POST',
      body: JSON.stringify(data),
    });

  }
}
{{! app/components/my-form.hbs }}
<form {{on 'click' this.submit}}>
  ...
</form>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!