I want add New Product without refresh the Page. If i use Form Tag model has been redirect same page. How to Avoid It. I am working in Laravel Project
$(document).ready(function() {
$("#add").click(function() {
$.ajax({
type: 'post',
url: $("#add").attr('data-url'),
data: {
'_token': '',
'form_data': $('#Form').serialize(),
},
success: function(data) {
$('#ledger_name').val('');
$('#openning_balance').val('0.00');
$('#ob_type').val('');
$('#under').val('');
$('#ledger_address').val('');
$("#newLedger .close").click();
alert("Data Inserted");
},
error: function(data)
{
var errors = '';
for(datos in data.responseJSON){
errors += data.responseJSON[datos] + '<br>';
}
$('#response').show().html(errors); //this is my div with messages
}
});
});
});
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2rrf9At
via IFTTT
Aucun commentaire:
Enregistrer un commentaire