After installation module error occurred loading file in the file field:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /file/ajax/field_product_images/und/form-xYBwHUczpMyzbDqu5D5O3cb1NMJWJvFxh3QWz6bJ5kQ
StatusText: parsererror
ResponseText: [{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"seven","theme_token":"PLaLffGOvWknDYap9oZJrymNMljWqdbyWpAQ_fZR6eU","css":{"sites\/all\/libraries\/colorbox\/example5\/colorbox.css":1},"js" ...

Error appear only on jQuery version 1.5

Comments

thermador’s picture

Version: 7.x-1.0-beta28 » 7.x-1.0-beta29

I went temporarily insane trying to figure out why all of my file fields (extra fields on content types to upload a file) were broken, and reported an Ajax parsererror similar to the one above whenever anyone tried to upload a file.

I'm glad someone posted this bug report; I would never have thought to check different jQuery versions.

It turns out, it was caused by the latest DrupalChat update. I went from beta 27 to beta 29 I think.

It can be fixed by installing the jQuery Update module and telling it to use jQuery v1.8

I think it is because DrupalChat is interfering with any other AJAX code on the site; any time there is an Ajax query, DrupalChat noses in and messes it up.

darklrd’s picture

This is really strange. Which polling method are you using? Thanks.

darklrd’s picture

Status: Active » Fixed

DrupalChat doesn't modify any other AJAX call apart from it's own. Please re-open this if the issue still exists.

Thanks,
Shashwat

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

sinn’s picture

Status: Closed (fixed) » Active

I confirm - ajax doesn't work when jquery 1.5. and drupalchat are enabled. We use "iFlyChat server" as polling method.

mygumbo’s picture

I have this issue too. I'm using drupalchat 7.x-1.4, iFlyChat server for polling, jquery version 1.5 for admin pages and 1.10 for the front-end pages. On a node/add/post form, clicking "Add another item" ajax button throws an error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /drupal/system/ajax
StatusText: parsererror
ResponseText: [{"command":"settings","settings":{"basePath":"\/drupal\/","pathPrefix":"","ajaxPageState":{"theme":"seven_custom","theme_token":"foecIvNSbzQo2a1btdRk3OvJKqEKZ-9qe0Xyu5NVkEc"

If in the drupalchat config visibility settings, I exclude
node/add/*
node/edit/*
the node form loads without chat as expected, then "Add another item" works the first time. However, after that first time, the Chat window shows up again (even though I haven't navigated away from the node edit page, and if I click "Add another item" a second time, I get the ajax error again.

If I change jquery update for admin pages to 1.7, the problem seems to go away.

vunda’s picture

I am looking for help: This is a search. I am trying to get data from my nodes by searching the title. I can't get it to work. Please anybody can give me some ideas.. Thank you for your time.

I can see the value but I can't display the results. "node_title" and the value = "anyvalue"

mymodule/src/form

MyModule.php

public function buildForm(array $form, FormStateInterface $form_state){
$form['#prefix'] = '

';
$form['#prefix'] = '

';
$form['#attached']['library'][] = 'core/drupal.dialog.ajax';
$form['node_title'] = [
'#type' => 'textfield',
'#title' => $this->t('Node\'s title'),
'#description' => $this->t('Enter a portion of the title to search for'),
];
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Search'),
'#ajax' => array( // Ajax callback where we will process
'callback' => '::promptCallback',
// the data came from the form and that we will receive//)
),
);
$form['#title'] = 'Search by Title';
return $form;
}

public function promptCallback(&$form, FormStateInterface $formState){

$node_title = $formState->getValue('node_title');

$query = \Drupal::entityQuery('node');
$query->condition('status', 1);
// $query->condition('title', '%'.$node_title.'%', 'like');
$query->condition('title', $node_title, 'CONTAINS');
$query->condition('type', 'income_poverty');
$entity = $query->execute();

$key = array_keys($entity);
$id = !empty($key[0]) ? $key[0] : NULL;
$response = new AjaxResponse();
if ($id !== NULL) {

foreach($id as $value) {
$content = 'Title does not exists

' . $value . '

';
$response->addCommand(new HtmlCommand('#search-result1', $content));
}

} else {
$content = 'Title does exists

' . $node_title . '

';
$response->addCommand(new HtmlCommand('#search-result2', $content));
return $response;

}

mymodulesearch.routing.yml

mymodulesearch.modal:
path: '/mymodulesearch/data'
defaults:
_form: '\Drupal\mymodulesearch\Form\MyModule'
requirements:
_access: 'TRUE'

Here is the error, similar above:

AjaxError:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /mymodule/data?ajax_form=1
StatusText: OK
ResponseText: TypeError: Argument 1 passed to Drupal\Core\Render\MainContent\AjaxRenderer::renderResponse() must be of the type array, null given, called in /Users/me/Sites/devfolder/d8.5.3/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php on line 89 in Drupal\Core\Render\MainContent\AjaxRenderer->renderResponse() (line 45 of /Users/me/Sites/devfolder/d8.5.3/core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php).

avpaderno’s picture

Version: 7.x-1.0-beta29 » 7.x-1.x-dev
Assigned: tfrajj » Unassigned
Issue tags: -jQuery 1.5, -Ajax