c# - ASP net 4 search and render the result in modal bootstrap -
how input text field , when click in button show result modal bootstrap using mvc? have follow class:
class vatsearch{ [required] public string vatnumber { get; set; } }
controller:
[httppost] public partialviewresult searchvatpartialview() { return partialview("searchvatpartialview"); } public jsonresult adduserinfo(searchvatpartialview model) { vatresponse result= new vatresponse(model.country,model.vatnumber) return json(result); } }
and have view form result
<form id="myform"> @html.labelfor(m => m.name) @html.textboxfor(m => m.name) @html.labelfor(m => m.address) @html.textboxfor(m => m.address) </form> function adduserinfo() { $.ajax({ url: '@url.action("adduserinfo", "home")', type: 'post', data: $("#myform").serialize(), success: function(data) { if (data.result) { $(':input', '#myform').not(':button, :submit, :reset, :hidden').val('') } else { $("#showerrormessage").append(data.responsetext); } } }); }
Comments
Post a Comment