Unable to disable and enable button based on condition Home Forums Visual Basic .NET Unable to disable and enable button based on condition
[HttpGet] public ActionResult ButtonValidation( int ? id) { var result = false ; var items = db.VW_PLAN_TY_STG.Where(x => x.JOB_BTCH_ID == id ).FirstOrDefault(); if (items.STAT_DESC == "Error" ) { result = true ; } return Json( new { emailSent = result }); }
this .btnvalidate = function (jobBatchId) { var url = '@Url.Action("ButtonValidation")/' + jobBatchId; var promise = $.ajax({ url: url, type: 'GET' , dataType: 'JSON' , processData: true , contentType: "application/json; charset=UTF-8" , cache: false , success: function (data) { if (data.emailSent == 'true' ) { $('#btnSubmit' ).prop( 'disabled' , true ); } else { $('#btnSubmit' ).prop( 'disabled' , false ); } } });
Salman BegPosted Jul 17, 2019, 12:41 AM
Smi10 KalathiyaPosted Jul 16, 2019, 12:26 PM