![]() ![]() The app.request returning all the posts but i only want the posts of specific category. Now i want to get all the items from posts object in the json file for this specific category. ![]() By clicking on the category link it navigates to category-details.html page along the selected category id in url. On categories page, app is getting all the categories from this json file and shows in the app categories page with no error, working fine. Var result = $.grep(res.posts, function(e)) Īpp.dialog.alert('Something went wrong, check your internet connection and try again' ,'Error') “video”: “https:/videos/9.mp4”,Īnd this the the content of my script in templateĬontentType: "application/json charset=utf-8", I am able to loop through the individual objects and find the elements. Command not found when using sudo jQuery Ajax: Variable as Header key Feb 11. Probably not worth the conversion overhead, but thats a one time cost for static data, so it might be useful. do adb push -a adbshell /bin/adbshell grep -v no devices done. There are jQuery plugins to that effect, like json2xml. In my app i am parsing this json file and get the list of categories and show in a list on categories page but when i go to category details page it is not getting the specific items from posts object. Another option I wanted to mention, you could convert your data into XML and then use jQuery.find(':idA') the way you wanted. grep () method removes items from an array as necessary so that all remaining items pass a provided test. I also suppose that grep function is faster, because it only accepts arrays. ![]() grep (array,function,invert) So in your case I would rather use grep () because using array this way is unnecessary: (arr). I have a json file which contains 2 objects (1: categories, 2: posts) The difference in its usage: Filter: (selector).filter (selector/function) Grep. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |