Hi All,
I am using jquery-1.10.2.js SharePoint 2013 ,Visual webpart.
I have created wcf service which gives response in json format in sharepoint and trying to get data by using jquery ajax call in Visual Webpart
$(document).ready(function () {
$.ajax({
type: "GET",
cache: false, url:"http://siturl/SampleService.svc/EmpInfo"),
contentType: "application/json; charset=utf-8",
dataType: "json",
processData: true,
error: function (jqXHR, textStatus, errorThrown) {
alert("Error occured - " + errorThrown)
},
success: function (data) {
//looping the data
}
});
});
Issue:If user select some value and click on save button the data getting stored in database but not showing in the UI.
If i click f5 the data will refresh on UI.Some times i need to click on f5 2 to 3 times then only the data will refresh.
When i deploy solution,i am not able to see the data.If i refresh again(Cliking f5),then the data will come.Some time i need to click 2 to 3 times on f5.The data is coming correctly but it requires additonal click of f5 to show on the visual webaprt.
Please help me
Regards,
Veeresh G
Iranna GPosted Jan 30, 2014, 6:29 AM
Thanks for your reply.I tried the approach u have said but no luck.
I followed some other link
http://stackoverflow.com/questions/10269262/jquery-need-to-press-f5-refresh-to-see-content
which says to add jQuery built cleaner solution
{ $.ajaxSetup({ cache: false }); });
I have tried with this but some times evrthing will work fine but some time again need to click on f5 to get data.
Regards,
Veeresh G
Jaganathan BantheswaranPosted Jan 29, 2014, 7:26 AM
The problem might be with the binding part of your ajax success function...
Try with different jquery functions like .html() or .text() to update the UI.
Iranna GPosted Jan 29, 2014, 7:07 AM
Thanks for your time and reply.
As suggested by you ,I am allready binding data in success method only but still i need to click f5 for data to load.
Regards,
Iranna G
Pranay RanaPosted Jan 29, 2014, 4:26 AM
I m not much aware about sharepoint but I guess you need to write code in "Success" function of jquery to refesh webpart or webpage data.
//write code to assign data to part you want to refresh