Thanks for reply.
when i used your code its showing only displayed records only i need all data which is esist in opportunityproduct entity.So I am using below code.
function GetGridVal() {
var id = Xrm.Page.data.entity.getId();
var req = new XMLHttpRequest();
req.open("GET", encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/OpportunityProductSet?$select=OpportunityId,OpportunityProductId&$filter=OpportunityId/Id eq guid'" + id + "'"), false);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var returned = JSON.parse(req.responseText).d;
var results = returned.results;
for (var i = 0; i < results.length; i++) {
var OpportunityId = results[i].OpportunityId;
var OpportunityProductId = results[i].OpportunityProductId;
alert(OpportunityProductId + "" + OpportunityId);
}
}
else {
alert(this.statusText);
}
}
};
req.send();
}
But here how i can get product name,quantity and all.....?