Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem reading webservice with jquery?
    primarykey
    data
    text
    <p>What's my function's problem? I want to read the response from my webservice but I just receive an error.</p> <p>The browser message is:</p> <blockquote> <p>undefined- status:error</p> </blockquote> <p>when I press the button I just see the error function of my jQuery call but I don't know why. Please help me.</p> <pre><code>function SetupCompanyInfo(companyID) { //alert('aaa'); companyID = '1'; $.ajax({ type: "POST", url: '../../../Services/CompanyServices.asmx/GetCompanyInfo', data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: OnSuccess, error: OnError }); } function OnSuccess(data, status) { SetMainBody(data); } function OnError(request, status, error) { SetMainBody(error + '- ' + request + ' status:' + status); } </code></pre> <p>My webservice:</p> <pre><code>using System; using System.Web.Services; using System.Web.Script.Services; /// &lt;summary&gt; /// Summary description for CompanyServices /// &lt;/summary&gt; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ScriptService] //[System.ComponentModel.ToolboxItem(false)] public class CompanyServices : System.Web.Services.WebService { [WebMethod] public string GetCompanyInfo() { string response = "aaa"; Console.WriteLine("here"); return response.ToString(); } [WebMethod] public string GetCompanyInfo(string id) { string response = "aaa"; Console.WriteLine("here2"+id); return response.ToString(); } } </code></pre> <p>My aspx file,part of head and my button code:</p> <pre><code>&lt;script src="../../Scripts/InnerFunctions.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="../../Scripts/TabMenu.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="Scripts/InternalFunctions.js" type="text/javascript"&gt;&lt;/script&gt; &lt;div dir="rtl" style="border: 1px solid #CCCCCC"&gt; &lt;asp:Image ID="Image1" runat="server" ImageUrl="../../generalImg/Icons/64X64/settings_Icon_64.gif" style="width: 27px; height: 26px" onclick="SetupCompanyInfo(1)" /&gt;&lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    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