Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //GetAll
- [OperationContract]
- [WebInvoke(Method = "POST", UriTemplate = "GetAll/{Token}", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare )]
- List<DataModal.Main.Company > GetAll(string Token);
- $("#btnCom").click(function(){
- $.ajax({
- type: "POST", //REQUEST TYPE
- dataType: "json", //RESPONSE TYPE
- url: "http://ws/method/token", // URL OF THE WS
- success: function(data) {
- $.each(data, function(i) {
- if (data.length != i) {
- $('#list').append("<option>" + data[i].Name + "</option>"); //fILL THE DDL. FOR EACH ITEM RETURNED ADD DATA[NAME] TO ONE LINE OF THE DDL.
- }
- });
- },
- error: function(err) {
- console.log("AJAX error in request: " + JSON.stringify(err, null, 2));
- }
- }).always(function(jqXHR, textStatus) {
- if (textStatus != "success") {
- alert("Error: " + jqXHR.statusText);
- }
- })
- });
Add Comment
Please, Sign In to add comment