SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had create .asmx webservice in projects. my doubts that is this able to use this webservice in sharepoint project?

suppose this is my code

source: function (request, response) {
                    url: "http://localhost:54946/VishalSir/UserName.asmx/FetchEmailList?callback=",
                    data: "{ 'mail': '" + request.term + "' }",
                    dataType: "json",
                    type: "POST",
                    crossDomain: true,
                    contentType: "application/json; charset=utf-8",
                    dataFilter: function (data) { return data; },
                    success: function (data) {
                        response($.map(data.d, function (item) {
                            return {
                                value: item.Email

its works in .net project but i have taken Add Service references in sharepoint projects use this script but its not work.. pl give me direction?

share|improve this question
Just for clarity, this is jQuery running on the client, right? – SPDoctor Nov 26 '11 at 9:12
yep..i had fetch data using ajax with json type..its work in normal localhost but not work in sharepoint webapplication. – Jigs Nov 26 '11 at 9:19
Sorry, I can't see why this code would behave differently in the context of a SharePoint application, since it is client-side code calling your web service. If you tell us what you mean by "does not work" someone may recognize the problem, otherwise I'm not sure we can help you with the information given. – SPDoctor Nov 26 '11 at 10:01
up vote 3 down vote accepted

Yes, you can use web services from within SharePoint. Since you are in this case using jQuery and will likely go from one domain (URL) to another (that is cross domain), you cannot use JSON as it is, but instead have to rely on JSONP.

I've written an example of usage in a post, where the SharePoint site is hosted in Office 365/SharePoint Online and the service is hosted in Azure. Check out:

share|improve this answer
thanks @wictor. – Jigs Nov 28 '11 at 5:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.