Note that there are some explanatory texts on larger screens.

plurals
  1. POASP .NET AJAX and JQuery
    text
    copied!<p>I'm trying to set up a simple JQuery example in order to make AJAX calls to a .NET webservice. Using the following example below I'm getting AJAX errors that are just saying 0 in the result instead of any meaningful message:</p> <p>Javascript Call</p> <pre><code>function QSHelloWorld() { var options = { type: "POST", url: "http://localhost:1087/QueryService.asmx/HelloWorld", data: "{}", contentType: "application/json", dataType: "json", success: AjaxSucceeded, error: AjaxFailed }; $.ajax(options); } function AjaxSucceeded(result) { alert(result.d); } function AjaxFailed(result) { alert("Error: " + result.status + " " + result.statusText); } </code></pre> <p>ASP .NET WebSite</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="jQueryTest._Default" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;script language="javascript" type="text/javascript" src="js/jquery-1.3.2-vsdoc2.js" /&gt; &lt;script language="javascript" type="text/javascript" src="js/qsAJAX.js" /&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="formMain" runat="server"&gt; &lt;div&gt; &lt;script type="text/javascript"&gt; QSHelloWorld(); &lt;/script&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>ASP .NET WebService</p> <pre><code>using System.Web.Script.Services; using System.Web.Services; namespace QueryService { /// &lt;summary&gt; /// Summary description for Service1 /// &lt;/summary&gt; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ScriptService] public class QueryService : WebService { [WebMethod] [ScriptMethod] public string HelloWorld() { return "Hello World"; } } } </code></pre> <p>When I make a call to the QSHelloWorld I get a messagebox saying Error: 0 with no further information.</p> <p>I'm currently running this example using Windows 7, do I need to have anything specifically installed besides the .NET Framework 3.5 SP1 in order to get this to run properly?</p> <p>Thanks,</p> <p>Daven</p>
 

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