why i cant read my webservice with jquery???

Posted by rima on Stack Overflow See other posts from Stack Overflow or by rima
Published on 2010-05-31T13:53:07Z Indexed on 2010/05/31 17:23 UTC
Read the original article Hit count: 202

Filed under:
|
|

what's my function problem?I wana read from my webservice but I just receive error :(

the browser message is:
"undefined- status:error"

when I press button just I see the error function of my Jqueary calling but I dont know why??plz help me.

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);
}

my webservice:

using System;
using System.Web.Services;
using System.Web.Script.Services;


/// <summary>
/// Summary description for CompanyServices
/// </summary>
[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();
    }

}

my aspx file,part of head and my button code:

<script src="../../Scripts/InnerFunctions.js" type="text/javascript"></script>

<script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>

<script src="../../Scripts/TabMenu.js" type="text/javascript"></script>

<script src="Scripts/InternalFunctions.js" type="text/javascript"></script>
     <div dir="rtl" style="border: 1px solid #CCCCCC">
                   <asp:Image ID="Image1" runat="server" ImageUrl="../../generalImg/Icons/64X64/settings_Icon_64.gif" 
                       style="width: 27px; height: 26px" onclick="SetupCompanyInfo(1)" /></div>

© Stack Overflow or respective owner

Related posts about c#

Related posts about jQuery