Reputation: 357
I have a test button that I use to call a WCF Service when pressed. Here is my code:
<input type="button" id="testbutton"/>
<script>
function jqueryTest() {
var text = document.getElementById('test').innerHTML;
$.ajax({
type: "GET",
url: "wcfServiceCall",
dataType: "json",
success: function(data) {
alert(data[0].output);
},
});
}
$("#testbutton").kendoButton({
click: jqueryTest
});
</script>
My WCF Service will return a custom object such as this:
[{"output":0.97,"name":"John Doe"}]
So, when I press the button the first time, I see an alert box with a value of 0.97. This is correct. However, say I go into my WCF Service and change the output to 0.12. When I press the button again, I still see a value of 0.97, but it should be 0.12 (if I call my web service from a browser, I see the correct value). So, what exactly am I doing wrong? I thought clicking the button would query the web service each time, but that doesn't seem to be the case because the value is not refreshed. Any help would be greatly appreciated.
Upvotes: 0
Views: 30
Reputation: 2606
Have you try forcing the ajax call to not use cache ?
$.ajax({
type: "GET",
url: "wcfServiceCall",
cache:false,
dataType: "json",
success: function(data) {
alert(data[0].output);
},
});
Upvotes: 3