Skip to main content
Commonmark migration
Source Link

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][1]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 [1]: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

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][1]. 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 [1]: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

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

Notice removed Draw attention by ummahusla
Bounty Ended with user3589536's answer chosen by ummahusla
Notice added Draw attention by ummahusla
Bounty Started worth 50 reputation by ummahusla
The first senctence remvoved, because it was inappropiate for SO
Source Link
Reporter
  • 3.9k
  • 5
  • 35
  • 48

What's up guys. 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][1]. 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 [1]: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

What's up guys. 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][1]. 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 [1]: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

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][1]. 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 [1]: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

Source Link
ummahusla
  • 2.1k
  • 3
  • 29
  • 42

How to get to previous ajax request

What's up guys. 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][1]. 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 [1]: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history