When submitting a webform I get the following error, but the form details do get submitted so I'm guessing it's something to do with the redirection. I have tried the disable redirection option but that's made no difference.

ajax.module: An unknown error has occurred.

also if I inspect the element the error is

error [
XMLHttpRequest
, "parsererror", "Invalid JSON: { "status": true, "updaters": [  ], "debug": [  ], "messages_error": [  ], "messages_status": [  ], "messages_warning": [  ], "redirect": "http://example.com/newsletter?sid=2072\x2685081914=1", "preview": null, "form_id": "webform_client_form_1874", "options": { "enabled": true, "disable_redirect": true, "remove_form": true } }"]

Comments

codekarate’s picture

I am getting this same error message. It also appears that when looking at the AJAX calls, the form is attempting to submit twice.

codekarate’s picture

I figured out why my form was submitting twice and was able to resolve that issue. It was being caused by me calling "Drupal.Ajax.init();" at the top of my javascript file, it is not needed. I am not sure why I put it there in the first place but I think another issue may have suggested it.

If you do not want the form to redirect at all, you can try the following that worked for me, however you will have to edit the ajax.module file.

Go to ajax.module around line 340 and change

$data['redirect'] = $form_state['redirect'];

To

 $data['redirect'] = NULL;

Keep in mind that this will disable redirects completely so none of your forms use the Ajax module will redirect after submitting. I also have not fully tested everything to ensure that it will not cause any other issues although it seems to work fine for me.

nagrgk’s picture

Guys , i understood where exactly this error is loading from. The ajax error due to parsing error. The function of form_set_ error is working with jquery 1.3 ver .Its doesnot support laest versions .So, W e need o add json_decode function in inc.php which will solve ajax login/register error. If you have more questions , reply on same

voughndutch’s picture

I think that I am having this issue, can you shed some light on how to fix this?

ROBERT DEL ROSSO’s picture

People, I’m guessing you are getting this “ajax” error when creating web sites. But I am getting: “ajax.module an unknown error has occurred” when I am just posting a comment to an article on economist.com.

I have posted comments on that website for over 3 years, and never had this problem. Can anyone tell me why I have this error message now and how I can eliminate it? Thanks!

ROBERT DEL ROSSO’s picture

nagrgk, I’m guessing you are getting this “ajax” error when creating web sites. But I am getting: “ajax.module an unknown error has occurred” when I am just posting a comment to an article on economist.com. I don’t even KNOW Javascript!

I have posted comments on that website for over 3 years, and never had this problem. Can you tell me why I have this error message now and how I can eliminate it? Thanks!