Skip to content

Instantly share code, notes, and snippets.

@abigoroth
Created January 20, 2015 10:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abigoroth/ddef4289210de75c3e49 to your computer and use it in GitHub Desktop.
Save abigoroth/ddef4289210de75c3e49 to your computer and use it in GitHub Desktop.
products = [];
$.each( $(".directory-list > div") , function(i,v){
product = {
company: $(v).find("div.fldcomp_add2").text().split(":")[1],
product: $(v).find("div.comp_name").text(),
expirary: $(v).find("div.fldcomp_date").text().split(":")[1]
};
console.log( product );
products.push(product);
})
// dalam pada tu boleh guna $.each([1,2,3], ...) dan combine dengan $.ajax() untuk iterate setiap page. eg:
$.each([1,2,3] , function(i,v){
$.ajax({
url: "http://www.halal.gov.my/v4/ext/index.php?route=directory/search&filter_category_id=0&filter_industry_id=&filter_state_id=&limit=25&page="+v,
success:function(data){
console.log(data)
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment