I'm working on one script which contains a lot of ajax requests. Script is working absolutely fine, I have there a lot of dynamic content which is changing depends on user's select or search input.
I've started looking for how I can to manipulate the browser history and basically make these request saved in browser history. I've went through MDN - Manipulating the browser history
. I've got the general idea of this article, but I'm a bit struggling with implementing it in my project.
Here is a bit of code for live search part:
$('#search').keyup(Foundation.utils.throttle(function(e) {
var searchField = $('#search').val();
var regex = /[\D]+/;
$('.loader').show();
if (regex.exec(searchField)) {
$.get("getEventsWithVideos.php?text=" + searchField, function(data) {
});
$.get("getClubsWithVideos.php?text=" + searchField, function(data) {
});
} else {
// If searchField is a number
$.get("getMembersWithVideos.php?text=" + searchField, function(data) {
$events.empty();
$clubs.empty();
$members.empty();
$membersdeep.empty();
$members.append("<h4>Members</h4>");
var vals = jQuery.parseJSON(data);
$.get("getVideosDyn.php?membershipno=" + vals['Member']['membership_no'], function(data) {
});
});
}
}, 400));
Can please someone point my up with snippet based on my code, how I can create a link for each request to be saved in browser history so I could create a button and add on.click goto 1 request back.
Thank you in advance