Click here to Skip to main content
15,666,286 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Trying to hit "DeleteJobQuote" controller through Ajax but no luck. Please guide me if anyone has any idea about it. The code seems OK but not able to do so. I am writing this code to delete a particular record from database.


What I have tried:

<pre><pre> [HttpPost]
        public JsonResult DeleteJobQuote(int jobQuoteid)
            using (var db = new KeysEntities())
                var delJob = db.JobQuote.FirstOrDefault(x => x.Id == jobQuoteid);
                if (delJob != null)
                    delJob.Status = "Delete";
                    return Json(new { success = true, Message = "JobQuote SuccessFully Deleted!" });
                    return Json(new { success = false, Message = "Delete UnSuccessFul " });



And JavaScript and Knockout

self.deleteJobQuote = function (jobQuote) {
         url: '/Companies/Manage/DeleteJobQuote',
            type: 'POST',
            dataType: 'json',
            data: JSON.Stringify({ jobQuoteid: 1028 }),
            //data: JSON.Stringify(jobQuote),
            contentType: 'application/json',
            success: function (result) {
                if (result.success) {
                else {
                    alert("You can not delete this record !!");
Updated 18-Jun-17 4:18am
Karthik_Mahalingam 19-Jun-17 4:53am    
what is the error in chrome console.

1 solution

public JsonResult DeleteJobQuote(string jobQuoteid) 
//then parse to int or other datatypes
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900