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);
});
The best way to do this (without using some hacky tricks) is to use a XMLhttpRequest that will send a POST request with your form and your custom data into it. To do this, you can use this $ajax object from jQuery. You can look at the exemple by W3School : http://www.w3schools.com/jquery/jquery_ajax_get_post.asp
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.