There is an e-commerce site that I'm working on that has thousands of pages in it (mostly product pages). I've got some jQuery that I'm running on about 1300 of these products. Only specific products need the code to run so what I've done is set up the product codes (which display in the URL of the product) in a JSON data sheet and I'm looping through the JSON data like this:$(document).ready(function(){$.getJSON('js/round.js', function(data) {    var location_var = location.pathname.indexOf('/product-p/main-product.htm')    for(i=0; i<data.records.length-1; i++){             var location_var = location_var +  || location.pathname.indexOf(' + data.records[i].productcode + ');    }    if (location_var != -1){        //DO SOMETHING TO THESE SPECIFIC PAGES    }});         });Now this functions but obviously it has to handle the 1300 hundred rows, check and then run my code. This causes a slight lag and unfortunately that lag will run on all of the pages because it has to determine if the page is correct for every page that it goes through.This is the only way I could think of doing this (my Javascript is a bit limited at this point) so I'm curious if anybody knows of a way to do this more efficiently and to make the query faster.Thanks for your help!
More Efficient Javascript indexOf query
javascript;jquery;json