I am working on a web app that pulls content using multiple JSON files. I have tried numerous methods of parsing the JSON, but only the following has worked for me.
Ultimately I would like to somehow store the contents of the JSON files locally and swap out as new content is available. Unfortunately, I don't know how to do that. And possibly a method of using a more current version of jQuery to parse my JSON files?
I'm using jQuery $.ajax or $.getJSON on document.ready to access data from the server through coldfusion remote cfc files.
My url looks something like this for the main page [url]
When i go to a new page i.e. [url]
The ajax functions are called but are not collecting new data (only in IE). IE caches the response and wont give me a new one unless I refresh the page, which I don't want to do.
Here's an example of a function I call. I've also tried $.getJSON with no success.
function getGrains() {
I've looked into ways to make sure IE wont cache files. Some of the popular suggestions are:
Add a random parameter to the url: I've done this:
Change get requests to posts: Done (see function)
Also, jQuery's cache:false doesn't work.
I'm not sure I can use the meta tags or header cache-control functions because it's not caching my html page, it just caches these HTTPRequests from within my javascript file, and they're not loading html, just json objects.
Is there a Jquery method I could use to quickly parse a JSONP object, looking for an embedded object called "error" ?? If I were to do the following: jQuery.each(query.data.error, function(i,error){ //....} And there wasNO .error in the returned JSON, what should I expect to happen? Basically, I want to know if "error" is in the JSON and process accordingly.
I am trying out $.ajax instead of getJSON for debugging purposes. Because getJSON did not report an error in IE (6,7 or 8) and I am trying to figure out why a jQuery plug-in is not painting my returned images to the screen in IE but is in other browsers. So I tried this. Interestingly enough, it hits the error event in IE but not firefox, safari and the rest and I don't know why (this code works great and renders my data just fine in FireFox and the rest). I know my returned json is valid:
I don't know what else to do to troubleshoot why IE is having so much trouble with the returned JSON or just executing the function(data) using either getJSON OR this. I have set the headers not the cache also in the response. IE refuses to enter my function(data) on the response.
Same result. Firefox and the rest had no issue. IE still exited the $.ajax and my error method kicked in. No rhyme or reason whatsoever and I tried the IE Dev tools... nothing. About the only thing I get is this: Line: 163 Error: System error: -1072896658.Line 163 which is simply the line: function() { alert("An error has occurred. try again."); This has got to be the most f*d up situation I've been in and I need to get this working! I just cannot understand why IE can't parse a getJSON or $.ajax response, that is impossible or else there would be a huge meltdown with jQuery.
i'm having problems with my json scripts. When I retrieve data that contains new lines it causes an error from firebug. I've used a couple of replace like
.replace("", ""), .replace(//g, "") but it still didn't work.
data = ajaxRequest.responseText ; var jsonOBJ = eval('(' + data + ')'); len = jsonOBJ.application.length ; key = jsonOBJ.application[i].optionValue ; value = jsonOBJ.application[i].optionDisplay ;
Internet Explorer is able to process the above code , but while trying from Firefox , I am getting the below error message
jsonOBJ has no properties [Break on this error] len = jsonOBJ.application.length ;
I'm baffled! I'm coding in HTML5 and getting back the geo coordinates with no problems; I set them as cookies for future reference, then pass them to a reverse geolocation server using $.getJSON in jQuery 1.5.1. I have to parse through the results, but I manage to get the user's US state location (which is my goal) in Firefox, but not in IE.
The JSON appears to be well-formed, and looks like this:
Code JavaScript: {"place_id":"3065317","licence":"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.","osm_type":"node","osm_id":"356821721","lat":"32.9029017","lon":"-96.5636022","display_name":"Church of the Nazarene, Main Street, Dallas, Texas, 75088, United
I am really stuck in parsing a JSON string and take it's values. I got the json string as
[Code]....
How to Parse this and take the Results for further processing in javascript.... I am waiting to hear from you Soon..I am using jQuery for the purpose...
I have a JSON file with multiple containers that has built a webpage. I need to create a javascript from this file to render a page since it was written to use a js library (I think scriptaculous or doj). I want to use jQuery to do this -- at least that's what I'm told I can do. I understand that JSON is a data-exchange language like XML. Here's some code:
Code: var nov_info= { 'categories':[ {N:'nwItem1',O:'Composition',V:School Supplies > Paper> Notebooks}, {N:'nwItem2,O:'Crayons',V:'Elementary > Art > Art Supplies'}, {N:'nwItem3',O:'Calculators',V:'High School > College Prep> Trigonometry'}, {N:'nwItem4',O:'Maps',V:'Middle School > US History > Civil War'} ], [Code]....
I have a textarea element, and a link action to empty the textarea.
$('.area').empty();
Normally it works fine. But after a ajax call to send the textarea value, the empty() stops working. I also tried text(), html(), none of them are working. The original text in the textarea still stays there. I have no way changing its value. My guess is firefox caches it or something.
I am using vs2010 and when I hit ctr + F5 it launches which ever broswer I select to browse with and tells it not to use the cached version of that web page. But regardless if its chrome, firefox,IE, opera or safari,they all seem tohit a wall and stop recognizing my changes code tweaks. How do I resolve this frustration! It is very trouble some when testing .json file changes and css changes.
It looks like IE is caching the response for some AJAX requests here. The app I'm working on is a catalog of sorts. Clicking the link for a category loads a set of "items". Those, in turn, may be deleted from the admin view. The delete works fine (I checked the DB) but, when loading the same set of category items, I'm seeing the list unchanged. That is, the thing that was deleted is still there. Sorry for the crap explanation but I'm not really sure of a better way of putting it. Bottom line is, has anyone seen this sort of behavior with IE before? Can it cache the result of an AJAX request like that? And, if so, how can I guard against that? Can I set cache-control headers for an AJAX request?
I have a complex JS object. It manipulates the page DOM. Inside it I have many repetitive selections spread across functions. I would like to cache the selectors to enhance performance. How do other people do this? I can cache on the function level but not the object. When I try to cache on the object level I seemingly end up with stale selectors that while defined don't actually work.
My gut is that I can only cache on the function level?
what I have read does not deal with caching inside a JS object.
I'm not having this issue with Mozilla Firefox, but it seems that the results of the code below are being cached in EI 8. When the browser makes another asynchronous call to the server with different results from the database, those results are not being displaying on the wepage. How do I fix this problem. As I mentioned above the code works fine in Mozilla Firefox. The page displays data in EI 8 with no errors five seconds after the page has loaded, but as the information in the database changes, I'm not seeing those changes reflected on the page in 5 second intervals. I'm assuming this is a caching issue, if so how do I fix it.
I have a html file that I want to load, loop through the json data and for each json entry I want to add a new block of the html and insert the json data into the matching div/class of the html. json looks like this:
So for each json entry of name/age, I want to insert that into the html, and then add another row, until all json data has been fetched. After this I want to insert all of this into #box, which is just a divthat should contain that html. Looping like this obviously does not work, since I just keep replacing the same html through the loop.
If I use javascript to 'read' and XML file does that mean that the XML file gets downloaded to the user's cache?
I'm building a quiz and I'd rather not have the answers too easily available. I believe there's no real way to secure anything client side with javascript so I'm just trying to keep the curious at bay.
I have a JSON structure in API.When I call the API in my code it returns as the same JSON .I have to print this JSON result as table with pagination in Javascript. The table should be dynamic with previous and next buttons and the table should populate the results according to the JSON and each page should have 20 entries and then the remaining entries should go on the next page and I should be able to go back and forth in the table using previous and next respectively.tell me the exact code of how to start with getting JSON from the API and then write the JSON data in the form of dynamic table with pagination.
I have a oc4j application server hosting my application . I can see from tcp monitor for eg: GET /scripts/main.js and the server responds with last-modified timestamp. However for subsequent request IE does not use if-modified-since and further for each script in Local Settings is getting cached as main[1].js, main[2].js etc and also in different directories. This does not happen for all script but if a page has some 15 scripts included the last 5 scripts show this behaviour.
I had an incident in which I uploaded a swf file with an incorrect URL. Well, when I noticed the issue I uploaded a 'new' file - but those who have previously seen the site kept seeing this "older .swf".Without a huge proces. renaming files, modifying html files etc.. Is there a way to customize a meta tag or some other mechanism to have a '.swf' file NOT CACHE. It has to not cache in all browsers.. ala: ie, ff, safari
I'm passing the asp parameters using the url current page is files.asp and I'm using window.location.href=files.asp?action=deletefile to pass the action to the serverside
My code never got executed (like the page was cached) unless i put document.write("") before the window.location directive.
Here's the code:
function confirmDelete(x){ var potvrda=confirm("Kliknite OK za brisanje. Cancel za povratak."); if (potvrda==true) { trans="files.asp?action="+x; document.write("") window.location.href=trans; } else {} }
I've created a page that uses HTTPRequest to include some XML data and allow the user to update that data. The problem is that the new data doesn't show up, even though the XML file is changed.
I can call the XML file up in a separate browser window, where I get the old data, refresh to get the new data, then when I refresh the first browser, the new data appears on the page.
I'm thinking this might be some sort of server caching issue. Has anyone else run into this? Does anyone have a solution?