JSON debug button in Chrome, reload button in IE (displayed as bare data)

Before anything: $. The getJSON back button showing the JSON return data, and not the page did not help, and also https://groups.google.com/group/angular/browse_thread/thread/3787ad609c0beb77/eb1b57069dab9f63 failed, and the Internet did not help either.

Here's the problem:

I call the url from the inside of the page to get json data, which is then processed using jquery templating inside the same page.

Imagine that we are at http://someurl.com/search and we start a query like this

$.ajax({
  url: '/searchthis', //important, this is NOT THE SAME URL
  cache: false,
  type: 'GET',
  headers: {
    "Accept": "application/json",
  },
  dataType: 'json'
  success: function(data) {
    doSomethingWithResults(data);
  }
});

Rack's answer has a cache control header that does not have a cache:

Cache-Control:no-cache

, Chrome, "", JSON. IE8. , Enter url .

, , Chrome (. http://code.google.com/p/chromium/issues/detail?id=108425)

, , -, ( ), - URL- ( JSON URL-)

+5
2

Rails: Chrome, IE , Rails , json. html- json .

respond_to do |format|
  format.html { ... } //important because the request comes with no specific format
  format.json { ... }
end
+6

Chrome. format.html

respond_to do |format|
  format.html
  format.js
end

, Chrome, , ajax, :

$.ajax({
   url: '/restful/path',
   data: { format: 'js' }, // This line here
   dataType: 'json'
});

, , , (.:format)

$.ajax({
   url: '/restful/path.js',
   dataType: 'json'
});

, -

+3

All Articles