Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery $.ajax failing no error message, server responded with 200 OK
    text
    copied!<p>I have an ajax call that works fine locally, but when I published it into the server, the code is never executed but returns "200 OK" anyway. No "success" code is ejecuted, nor the "error" code. Here's my ajax call:</p> <pre><code>$.ajax({ type: "POST", url: "/CargadorContadores.aspx/ObtenerContadores", contentType: "application/json; charset=utf-8", data: "", async: false, dataType: "json", success: function(data) { var myObj = JSON.parse(data.d); for (var i = 0; i &lt; myObj.length; i++) { var element = document.getElementById("LbItem " + myObj[i].MenuItemID); element.innerHTML = "&lt;b&gt;" + element.innerHTML + " (" + myObj[i].Cantidad + ")&lt;/b&gt;"; } }, error: function(xhr, status, error) { var err = eval("(" + xhr.responseText + ")"); alert(err.Message); } }); }); </code></pre> <p>I also tried to put the complete url in the "url" field but still no luck. The weird thing is that when I put the complete url directly into the browser, it is still not executing the code. And it works fine locally!!</p> <p>I know there's a similar post (<a href="https://stackoverflow.com/questions/10316111/jquery-ajax-failing-silently-no-error-messages-and-server-responded-with-200">jQuery $.ajax failing silently, no error messages, and server responded with 200 OK</a>) but is not resolved and it's driving crazy here.</p> <p>PD: this is NOT cross-domain, my ajax code is in a .ascx and I am trying to call a method on an .aspx</p> <p>Thanks very much!!!!</p> <p><strong>EDIT:</strong> I tried to remove the System.web.extensions reference of my web project and add the dll to my bin, but it's still not working (the 1.0.61025.0 version). Besides, I am running the ASP.NET website in IIS with <strong>framework 2.0</strong>, and I don't have <strong>framework 3.5</strong> installed on my server (but locally I do). Maybe that's the problem? I can't install it because of the client security policies, what shall I do?</p> <p><strong>EDIT 2:</strong> I tried doing a simple response from my .aspx, just to test if the problem was in that method, but it is still not executing the success function. Here's my .aspx code:</p> <pre><code>[WebMethod] public static string ObtenerContadores() { return new JavaScriptSerializer().Serialize("true"); } </code></pre> <p>and adapted the .ascx</p> <pre><code>$.ajax({ type: "POST", url: "/CargadorContadores.aspx/ObtenerContadores", contentType: "application/json; charset=utf-8", data: "", async: false, dataType: "json", success: function(dictionary) { alert("hello"); }, error: function(xhr, status, error) { var err = eval("(" + xhr.responseText + ")"); alert(err.Message); } }); }); </code></pre>
 

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