Tuesday 23 August 2016

Get Data for Json Api By Jquery



jQuery(document).ready(function(){
$.ajaxSetup({
headers: {
'X-Api-Key': 'dhada78dshdks',
'X-Store-Id': 1024,
},
}),
$.ajax({
type: "POST",
url: "https://www.app2mobile.com/ci_app2dine/api_web/getCategoriesAndProduct",
dataType: 'json',
data : {store_id: 1024},
success:function(responce){
console.log(responce.data);
var catandpros = responce.data;
var arr = $.map(catandpros, function(el) { return el; })
console.log(arr);
var section = 1;
var menu_div = '';
arr.forEach(function(entry){
menu_div += entry['category_name'];
menu_div += '<br>';
});
  jQuery('#output').html(menu_div);
  }
 });
});

</script>

No comments:

Post a Comment