c# - jsonresult does not come back? -


trying display success message controller?

  [httppost]     public jsonresult succesmsg()     {         return json(new { success = true });     } 

jquery:

        $("#but").click(function () {             $.ajax({                 url: "/home/succesmsg",                 type: 'post',                 data: "",                 success: function (result) {                     if (resultjson['success'] == true) {                         alert('success');                     }                      else                     { alert('no'); }                 },                 error: function (err) { alert('error') }             });         }); 

add datatype: "json" $.ajax call or use shorthand: $.getjson.

also check controller handles response returns in state http 200 (ok).

for debugging, add complete: function(){alert('complete');} see if request completes or not. debugging tools (add-ons) firefox live http headers , firebug.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -