Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's a simple <code>$.ajax(..)</code> call <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">http://api.jquery.com/jQuery.ajax/</a></p> <p>In WCF you can create Rest Service (return JSON) and consume this JSON response in jQuery</p> <p><a href="http://msdn.microsoft.com/en-us/netframework/dd547388" rel="nofollow">http://msdn.microsoft.com/en-us/netframework/dd547388</a></p> <p>Lots of example in internet.</p> <p>Sample in c# (Atom feeds):</p> <pre><code> [ServiceContract] public interface INewsFeed { [OperationContract] [WebGet] Atom10FeedFormatter GetFeeds(); } public class NewsFeed : INewsFeed { public Atom10FeedFormatter GetFeeds() { SyndicationFeed feed = new SyndicationFeed("My Blog Feed", "This is a test feed", new Uri("http://SomeURI")); feed.Authors.Add(new SyndicationPerson("someone@microsoft.com")); feed.Categories.Add(new SyndicationCategory("How To Sample Code")); feed.Description = new TextSyndicationContent("This is a how to sample that demonstrates how to expose a feed using RSS with WCF"); SyndicationItem item1 = new SyndicationItem( "Lorem ipsum", "Lorem ipsum", new Uri("http://localhost/Content/One"), "ItemOneID", DateTime.Now); List&lt;SyndicationItem&gt; items = new List&lt;SyndicationItem&gt;(); items.Add(item1); feed.Items = items; return new Atom10FeedFormatter(feed); } } </code></pre> <p>and in svc you just need to add (<strong>Factory</strong> part):</p> <pre><code>&lt;%@ ServiceHost Language="C#" Debug="true" Service="RssReader.Wcf.NewsFeed" CodeBehind="NewsFeed.svc.cs" Factory=System.ServiceModel.Activation.WebServiceHostFactory%&gt; </code></pre> <p><strong>Edited:</strong></p> <pre><code>&lt;system.serviceModel&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt; &lt;serviceMetadata httpGetEnabled="true"/&gt; &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --&gt; &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; </code></pre> <p>Important part is <code>&lt;serviceMetadata httpGetEnabled="true"/&gt;</code> in that scenario you don't need to define any endpoints</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload