Ajax call with webservice

Hi, i have a this code working properly. but i need a similar alternative using enyo. My question is based on the parameters in ajax.go(params).

$.ajax({
url: 'http://c1/api/SSB',
type: 'GET',
data: {
Token: 'infa9',
Method: 'GetAvailabilityDEV',

Parameters: [ {
Name: '@server',
Value: 'u2283c'
}
]
},

contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert(this.url) ;
console.log(data);
},
error: function (e) {
console.log(e);
}
});


The previous code is working and it generates my json format, but i cant do it using enyo, i have something like this:

var params = { method: "GetAvaillabilityDEV",
token: "infa9",

Name: '@server',
Value: 'u2283c',
};

var ajax = new enyo.Ajax({
url: "http://c1/api/SSB",
method: "GET",
handleAs: "json"

});
ajax.go(params);
ajax.response(this, "gotResponse");
},


Comments

  • Hi @edipoelrey‌, the parameters you send to enyo.ajax.go() represent your query string and will be serialized if they are a hash. Is it your intention to send all of these key/value pairs as query string parameters? I noticed in your jQuery sample, you have a parameters array and I'm unsure of how they're being used in that context, as the data hash is being converted to a query string.
  • thank you aarontam, i finially decide to get enyo aside and use the jquery option :) i coundt find an other way to pass de parameters. So thank you, again
Sign In or Register to comment.