vendredi 8 juillet 2016

submit a lararvel form with jquery


how can i submit a lararvel form with jquery (not ajax) but simple post with data(object or array) and retrieve this data for the method in the controller var index = 0; var seance = [];

$( "#addSession" ).click(function() 
{

  var session_name = $('#session_name').val();
  var session_description = $('#session_description').val();
  var session_lieu = $('#session_name').val();
  var session_date = $('#session_date').val();
  if(seance[session_date])
  {
    index ++;
    seance[session_date][index]= [];
    seance[session_date][index]['name']= session_name;
  }
  else
  {

    seance[session_date] = [];
    seance[session_date][index]= [];
    seance[session_date][index]['name']= session_name;
  }

  console.log(seance);




});


$( '#form-create-event' ).on( 'submit', function(e) {

        /* how to add seance to data submitted with the form and how can i get it from the controller  */
        console.log('submitted');
        /*e.preventDefault();*/
        console.log(e);
});

Aucun commentaire:

Enregistrer un commentaire