just trying to learn ajax on asp.net mvc,but dont know whats wrong with it?
my controller class method=>
[HttpPost] public JsonResult Getdata(string batchcode) { ///var studentid = db.Studentassignbatches.Where(x => x.batch_code == batchcode).Select(x => new Studentassignbatche { UserId = x.UserId }).ToList(); return Json("hi",JsonRequestBehavior.DenyGet); } and my view and ajax request>
<select onchange="ShowBatchCode()" id="BatchList" class="form-control input-lg"> <option class="pull-left" value="CCNA Security-1">CCNA Security-1</option> <option class="pull-left" value="CCNA Security-2">CCNA Security-2</option> <option class="pull-left" value="JNCSP-SEC-1">JNCSP-SEC-1</option> <option class="pull-left" value="Oracle Database 12c-1">Oracle Database 12c-1</option> </select> and ajax=>
<script type="text/javascript"> function ShowBatchCode() { var batchcode = $('#BatchList').val(); $.ajax({ type: 'POST', dataType: 'json', contentType: 'application/json', url: 'Getdata', data: { batchcode: batchcode }, success: function (data) { alert(data); }, error: function (result) { alert('Something Went Wrong!'); } }); } and it always show me a alert "Something Went Wrong!".so i debug my web page and i found=> 
505 Internal server Error.i dont know how to solve it.and try to remove [Httppost] and also try use
data: batchcode, but nothing works for me.help me please?anybody!!!!!