Note that there are some explanatory texts on larger screens.

plurals
  1. POIE tries to download JSON in ASP. NET MVC 3
    primarykey
    data
    text
    <p>I was trying to return Json from my action and after that IE tried to download it and showed me save dialog. I tested it in Firefox, and there it works fine.</p> <pre><code>return Json(new { success = false, message = ex.Message }, "application/json"); </code></pre> <p>What is the reason of that behavior and how can I solve that issue?</p> <p>After that in Javascript part I try this</p> <pre><code> if (responseJSON.success == false) { alert(responseJSON.message); cancel(); } </code></pre> <p>But IE doesn't show alert anyway. It brings me save dialog.</p> <p>I tried to change <code>"application/json"</code> with <code>"text/plain"</code> and save dialog disappeared, but I am not able to see alert yet. What am I missing?</p> <p><strong>EDIT:</strong></p> <p>Here is my complect Javascript, I am using Valums qquploader(ex-Ajaxupload) for uploading images</p> <pre><code> var uploader = new qq.FileUploader({ element: document.getElementById("image-upload"), action: '/Home/ImageUpload', allowedExtensions: ['jpg', 'png', 'gif'], sizeLimlit: 2048,onComplete: function (id, fileName, responseJSON) { if (responseJSON.success == false) { alert(responseJSON.message); cancel(); } else { alert("success"); //some code here } } }); </code></pre> <p>I had tested with <code>alert("success");</code> in my else part and forwarded json as <code>"text/plain"</code> and after that I saw the alert. But in that time <code>responseJSON.success != false</code> for me. Have you any suggestions about that?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload