Reputation: 319
I am playing with my WordPress site on my dev server trying to get a custom plugin to call a restful service. The plugin references a JavaScript file with uses jQuery and Ajax. I am trying to call a restful service to get some data when I change the state of a radio button. The code below gets executed, and the results to the screen are "Here are the awesome results:", so it appears that the web service was called, and no data was returned. I have some logging in the web service so that I can know for sure that the web service is actually getting called, and it appears as though the web service is never getting called from this code. So I have plenty of questions, such as do you see what I am dong wrong? Why would the success function be called when it clearly didn't hit the service? And what can I do to debug this?
jQuery.ajax({
url: "http://myAwesomeServer:8080/myAwesomeService.svc/GetAwesomeData/Hurry",
type:"GET",
success:function(data) {
jQuery(".customConfigurator").text('Here are the awesome results:');
jQuery(".customConfigurator").append(data);
die();
},
error: function(MLHttpRequest, textStatus, errorThrown){
//console.log(errorThrown);
alert(errorThrown);
}
});
Upvotes: 1
Views: 30