Search This Blog

Monday 9 September 2013

Ajax calls to services not working (Cache Problem)


var thiSite = _spPageContextInfo.webAbsoluteUrl;
var servicePath= "/_vti_bin/WCF/LeaveService.svc/Data";
            var MyUrl = thiSite + servicePath; 
$.ajax({
                type: "GET",
                url: MyUrl,
                cache:false,//Ensure that calls are not depend on cache
                contentType: "application/json; charset=utf-8",
                dataType: 'json',
                processdata: true,
                success: function (msg) {
                    alert("Sucess");
                    var Array = new Array();
                    //Gets the Data                    $.each(msg, function (i, item) {
                        Array[i] = item;
                    });                                                      },
                error: function (msg) { alert("Eror"); }
            });

No comments:

Post a Comment