I'm trying to use jQuery to get data from an ASP.NET web service (SharePoint Server 2007 lists.asmx) but any call to a web service will really help as a first step in that direction.
|
I use this method as a wrapper so that I can send parameters. Also using the variables in the top of the method allows it to be minimized at a higher ratio and allows for some code reuse if making multiple similar calls.
Hope that helps. please note that this requires the 3.5 framework to expose JSON webmethods that can be consumed in this manner |
|||||||||||
|
The problem with @mnour source is that jQuery is not going to be able to deserialize the WSDL file returned. You need to make sure it is deserialized in JSON or XML. |
|||
|
Here is an example to call your webservice using jQuery.get:
In the later example, you call "webservice.asmx", giving it 2 parameters: name and time. Then, a function is called in callback. |
||||
|
I don't know about that specific SharePoint web service, but you can decorate a page method or a web service with Dave Ward has a nice walkthrough on this. |
||||
|
I have a decent example here on using the JQuery AJAX call with asmx web services... http://sonerdy.com/JQuery-AJAX-and-ASMX There is a line of code to uncommment in order to have it return JSON. |
||||
|
|
|||
|
I quite often use ajaxpro along with jquary. ajaxpro lets me call .net functions from JS and I use jquary for the rest. |
|||
|
SPServices is a jQuery library which abstracts SharePoint's Web Services and makes them easier to use It is certified for SharePoint 2007 The list of supported operations for Lists.asmx could be found here ExampleIn this example, we're grabbing all of the items in the Announcements list and displaying the Titles in a bulleted list in the tasksUL div:
|
|||
|