referencing a WCF web service
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 work开发者_如何学Gos 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, ShawnEDIT: 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.
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
精彩评论