- [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 });
- }
Unable to disable and enable button based on condition
- this.btnvalidate = function(jobBatchId) {
- var url = '@Url.Action("ButtonValidation")/' + jobBatchId;
- var promise = $.ajax({
- url: url,
- type: 'GET',
- //data: jobBatchId,
- 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);
- }
- }
- });

Smi10 KalathiyaRank #1,136 · 1.6K reputationPosted Jul 16, 2019, 8:26 AM EDT
Salman BegRank #284 · 8.8K reputationPosted Jul 16, 2019, 8:41 PM EDT