5

I've read about this issue elsewhere and the primary culprit has been Views and the jQuery Update module...particularly having jQuery set to anything but v1.5. I'm getting the JSON dump when saving a node:

[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"my_theme","theme_token":"yyYQcgn3UELRKecX6yTsTIV8lKutRmg3bBIpqbjACzE"}},"merge":true}]

I need jQuery 1.7 for an image rotator that I'm using and I found a patch for jQuery Update that allows you to set the version of jQuery for admin and and front-end so I have 1.5/1.7 set respectively and yet I'm still seeing this issue. I have confirmed that jQuery v1.5.2 is being loaded. I do see that jquery.form.min.js v2.69 is being loaded from the jQuery Update module along with jquery.cookie.js...could these be causing the problem?

This is the URL after clicking save and seeing the JSON dump:

http://mydomain.com/views/ajax?title=test&sitename=&type=All&uid_1=&status=All&vid=All&language=en&__utma=1.98635126.1382890057.1383491752.1384184897.6&__utmz=1.1382890057.1.1.utmcsr%3D(direct)|utmccn%3D(direct)|utmcmd%3D(none)&Drupal_toolbar_collapsed=0&Drupal_tableDrag_showWeight=0&has_js=1&SESS0e1269226b42fa1c68bd46a4609d8d90=YIk12tixVnxuF9Om77vikXdp7Il8oxAYukuDswiCJoI&__utmc=1&SESSe5a8c6595a55e490f10153304dbfc1ee=El6m94kqyvIsFjx_IDJkC6-nujMMHCed4oVBpPNnvXA

The error only seems to occur when I edit a node after searching for it on the Find content page. I'm using the Administration Views module as well.

All modules have been updated as well as core (7.23). I have the jQuery admin overlay disabled in an attempt to solve the problem. Is there anything else I can check/do to alleviate this issue?


Now that the issue is repeatable, I disabled jQuery Update and still received the same JSON dump, so that's not the issue :s

6
  • It has something to do with the extra destination parameters. /admin/node/xyz/edit?destination=admin/content works just fine, but /admin/node/xyz/edit?destination=admin/content%3Fq%3Dviews/ajax%26title%3Dtest%26sitename%3D%2...fails Nov 11, 2013 at 21:37
  • That's it. I patched views/modules/node/views_handler_field_node_link_edit.inc to set the query to an empty array().
    – mpdonadio
    Nov 11, 2013 at 21:49
  • Thanks! Is there an patch file or just something you hacked together yourself? I know where to look now so I should be able to figure it out!! Nov 11, 2013 at 22:05
  • 2
    This question appears to be off-topic because it is about a bug in Views or Administration Views module, and should be reported to issue queue on drupal.org
    – Mołot
    Nov 18, 2013 at 22:56
  • 1
    @SomethingOn Issues found in existing modules/themes are defined off-topic here. Solving problems with bugs on DA was discussed in this meta question - feel free to answer or comment there, or create new meta question if needed. SE is not for replacing projects' issue queues. It's bad approach as it divides effort. Anyone able and willing to fix bugs in module X already monitors X's issue queue.
    – Mołot
    Nov 20, 2013 at 10:26

4 Answers 4

6

We were having this same issue on our company website. We have Administration Views installed, and use jQuery 1.8 as default version and 1.5 for admin pages.

As SomethingOn mentioned above, we were consistently seeing the JSON dump after filtering on the Find Content view, editing a node then saving. The URL paths all had 'views/ajax' in the query string of the node edit URL; e.g.,

/node/XXXX/edit?destination=admin/content%3Fq%3Dviews/ajax%26title%3D%26type%3DAll%26author%3D%26status%3D0%26vid%3DAll

What I ended up doing was turning AJAX off (under Advanced > Other > Use AJAX) for the Find Content view (Administration:Nodes). This removed 'views/ajax' from the node edit paths and resolved the issue for us.

4

Thanks to MPD, this is how I solved it:

/* sites/all/modules/views/modules/node/views_handler_field_node_link_edit.inc */    
if(strpos($this->options['alter']['query'], 'admin/content') !== FALSE) {
  $this->options['alter']['query'] = array('destination' => 'admin/content');
}

Basically if the destination contains admin/content, force it ONLY be admin/content, no additional parameters.

4

You may be having an issue with the Admin Views module that allows advanced filtering of nodes using Ajax on Drupal's Content screen.

Drupal Admin Content Editing Screenshot

Every time I've encountered the issue, I've filtered the list of nodes, and — after saving the changes — get shown the JSON data dumped to the screen instead of being taken to the node view.

It doesn't happen all the time, but often enough to be absolutely infuriating.

What worked for me was to disable Ajax for the Administration: Nodes view ("Find and manage content") at /admin/structure/views/view/admin_views_node/edit.

Here's what you need to do:

  1. Login to Drupal
  2. Go to Structure > Views
  3. Find the Administration: Nodes view
  4. Under Operations, choose Edit
  5. Click on the Advanced column section heading
  6. Under Other, change Use Ajax from "Yes" to "No"
  7. When prompted, Save the changes

Drupal Admin Views Module Screenshot

Now, when filtering the list of nodes on the content screen, performing a query will reload the page instead of instantly showing the results via Ajax — it's a tiny tradeoff, but absolutely worth it to fix the problem.

With Ajax disabled, the Admin Views module modifies the query string it builds, which is where the problem originates.

Here's a simplified example using URL decoded parameters for readability:

Using Ajax (Default):
/node/123/edit?destination=admin/content?q=views/ajax&title=Foo...

Without Ajax:
/node/123/edit?destination=admin/content?title=Foo...

You'll notice the q=views/ajax parameter is absent from the non-Ajax node edit path, which seems to fix the issue.

You can easily test this hypothesis by removing the suspect parameter from the Ajax-enabled node edit destination path.

Tested with Drupal 7.3.4 using Administration Views 7.x-1.3 and jQuery Update 7.x-2.4 (set to jQuery 1.10).

2
  • We had this problem with editing users, thanks for the fix. Feb 4, 2015 at 20:42
  • This is a quality answer. Thanks for the explanation and step-by-step solution. Kudos! Apr 9, 2019 at 17:12
0

The reason for the problem has already been found in previous answers and also all the workarounds proposed work.

I'd like to add that if you want your view to still work with ajax and also not loose the filters added in the destinations, there is a core patch available that I've tested on both on an nginx environment and on Azure that uses IIS.

I recommend applying this: https://www.drupal.org/node/1036962

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.