tags:

views:

49

answers:

2

Our current project uses an asmx service. We want to keep this service for now, but would like to add an additional wcf service for ajax calls.

I followed a procedure i found online to set up the service and it works fine with javascript in aspx files within that particular project but i'm unsure how to reference it in javascript files in a different project (in the same solution).

If someone could point me in the right direction it would be much appreciated.

Thanks,
Shawn

EDIT: i wish to make calls in javascript similar to the following:

   function Button1_onclick() {
    var service = new AjaxServices.TestService();
    service.wcfTest(4, onSuccess, null, null);
}

function onSuccess(result){

    document.getElementById("ajaxPlaceHolder").innerHTML = "<p>" + result + "</p>";
}

// ]]>

but i'm willing to explore the jQuery option as well.

A: 

Are you hosting your webapps in IIS?

What OS/IIS version?

How are you making your ajax calls (jquery/asp.net web extensions/other)

If it's a seperate webapp which will run as it's own website, i.e., not another virtual directory, then you'll probably need to set the URI in code somewhere. Possibly a web.config appsetting that gets red in a can be written out into a page level js variable using the ClientScript.RegisterStartupScript method.

More info would help.

Matt

MattC
the OS is vista x86 and i'm running iis6.
ErnieStings
Where is AjaxServices.TestService() defined? Are you using the ScriptManager Service reference template or is it a javascript prototype based class?If using the ScriptManager then the service reference path will need to be a path to the service on the other project.You didn't reply with whether or not you are using a website per project or virtual directories within the same root?
MattC
A: 

If you use ASP.Net MVC for your json services, you could do it as shown in this link: http://nayyeri.net/using-jsonresult-in-asp-net-mvc-ajax

Shiraz Bhaiji