What would be the correct function to call the following WCF REST service
http://xx.x.x.xxx/GAdmin/WGService/Service1.svc/RetrieveData?term=apple
with the following parameters added
term=apple
username:joe password:pote
and being json it should be have a callback function for jsonp
$.getJSON('http://xx.x.x.xxx/GAdmin/WGService/Service1.svc/RetrieveData?term=apple
callback=?'{
content: { username: "joe", password: "pote" },
function (data)
{
alert('Received ' + data + ' results');
};
Cannot figure out problem but if possible go throught this post
Steps to Call WCF Service using jQuery
I don't know exactly how you're WCF service is currently configured, but the following code block will call the service and the results would be passed into the callback.
$.ajax({
cache: false,
type: "GET",
async: false,
url: "http://xx.x.x.xxx/GAdmin/WGService/Service1.svc/RetrieveData?term=apple",
contentType: "application/json",
success: function (response) {
/* SUCCESS FUNCTION */
},
error: function (error) {
/* ERROR FUNCTION */
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.