Guest User

Untitled

a guest
Feb 23rd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. //GetAll
  2.  
  3. [OperationContract]
  4.  
  5. [WebInvoke(Method = "POST", UriTemplate = "GetAll/{Token}", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare )]
  6.  
  7. List<DataModal.Main.Company > GetAll(string Token);
  8.  
  9. $("#btnCom").click(function(){
  10. $.ajax({
  11. type: "POST", //REQUEST TYPE
  12. dataType: "json", //RESPONSE TYPE
  13. url: "http://ws/method/token", // URL OF THE WS
  14. success: function(data) {
  15. $.each(data, function(i) {
  16. if (data.length != i) {
  17. $('#list').append("<option>" + data[i].Name + "</option>"); //fILL THE DDL. FOR EACH ITEM RETURNED ADD DATA[NAME] TO ONE LINE OF THE DDL.
  18. }
  19. });
  20. },
  21. error: function(err) {
  22. console.log("AJAX error in request: " + JSON.stringify(err, null, 2));
  23. }
  24. }).always(function(jqXHR, textStatus) {
  25. if (textStatus != "success") {
  26. alert("Error: " + jqXHR.statusText);
  27. }
  28. })
  29. });
Add Comment
Please, Sign In to add comment