jquery - calling controller from view using ajax -
trying call controller , pass data variable mat
holding. not calling controller function.please me, how proceed?
$('#buttonadd').click(function () { var mat = $('#material_name').val(); $.ajax({ type: "post", url: $("#baseurl").text()+"gc_purchase/add_material_info"+mat, success: function (data) { $('#demo').html(data).show(); }, error: function (xhr, ajaxoptions, thrownerror) { $('#material_name').text("error encountered while saving comments."); } }); });
try this:
$.ajax({ url: '/home/addbooking', type: 'post', datatype: 'json', data: { starttime: starttime, endtime: endtime, productid: productid }, success: function (data) { location.reload(); }, error: function (jqxhr, textstatus, errorthrown) { alert(errorthrown); } });
Comments
Post a Comment