jquery - How to refresh ajax results based on link clicked -
i have problem. i'm sending ajax request , data load right results depending on link that's click. when click different link , request results reflect link. retains value previous link. appreciated. here's i'm doing. here's ajax call
$('body').on('click', 'button', function () { $.ajax({ url: fullurl, type: "get", datatype: "json", ifmodified: true, success: ondatareceived, error: onerror//, // data: data }); });
now when click button right values first time, when click different link change 1 of values result doesn't change. it's caching results. i've tried setting cache false, clearing browser cache avail. doing wrong
my success function this
function ondatareceived(series) { // push new data onto our existing data array count = 0; (var prop in series) { if (series.hasownproperty(prop)) ++count; } (i = 0; < count; i++) { if (!alreadyfetched[series[i].label]) { data.push(series[i]); } } $.plot("#placeholder", data, options); }
add query string url typically current time :
var time= new date().gettime(); var path = 'http://hostname.domain.com/api?time=' + time;
this make sure url changes each time, ideally no caching occur
Comments
Post a Comment