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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -