Sweetalert / Rails and Webpack - CREATE - POST method

rails
webpack

#1

Hi everyone I stuck on that mission and I can’t figure out the right way to do this.

:x: (method: :patch or post ) :point_right: I can’t figure how to build the correct pattern to include a form for that objet and also to store the attribute inside my DB.

I would like to store a cellphone number through a form inside the sweetalert.
For instance here where I am


:point_right: for Webpack component

import Rails from 'rails-ujs';
import swal from 'sweetalert';
import 'swal-forms/swal-forms.js';
import 'swal-forms/swal-forms.css';

:point_right: my current code

$('#btn-submit').on('click',function(e){
   e.preventDefault();
   var form = $(this).parents('form');
     swal.withForm({
        title: 'Cool Swal-Forms example',
        content: {
        element: "input",
        attributes: {
          placeholder: "Type your password",
          type: "password",
           },
       },
      buttons: ["foo", "bar"],
      icon: "success",
      closeModal: true,
      formFields: [
        { id: 'name', placeholder:'Name Field', required: true }
       ]
     })
});

:white_check_mark: (method: :delete ) :point_right: I’m able to delete (method: :delete ) any kind of object with Sweetalert / rails / webpack if some of you need help about delete methode ROR Sweetalert Weback my solution works let me know .