Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. [OperationContract]
  2. [WebInvoke(UriTemplate = "PlaceQuestion",
  3. RequestFormat = WebMessageFormat.Json,
  4. ResponseFormat = WebMessageFormat.Json,
  5. Method = "POST",
  6. BodyStyle = WebMessageBodyStyle.Bare)]
  7. string PlaceQuestion(Questions question);
  8.  
  9. <httpProtocol>
  10. <customHeaders>
  11. <add name="Access-Control-Allow-Origin" value="*"/>
  12. </customHeaders>
  13. </httpProtocol>
  14.  
  15. var json = JSON.stringify({
  16. Type : 0,
  17. Question: "testing"
  18. });
  19.  
  20. var url = 'http://localhost:49753/RestServiceImpl.svc/PlaceQuestion';
  21.  
  22. var params = 'json=' + json;
  23. var headers = new Headers();
  24. headers.append('Content-Type', 'application/json');
  25.  
  26. return this._http.post(url, params, {
  27. headers: headers
  28. })
  29. .map(res => res.json());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement