Lars7 pro asked 6 years ago


I followed the instructions to add Ajax and PHP to a contact form from here:

But I have this error [Object Object] after I press the send button.


Can anyone help with this.


Ps, The server i'm using is my NAS devise .

Lars7 pro answered 6 years ago

  Hi Dawid, This is what I got from the code you provided in the console part of the browser which is what i put in. Have i used it properly? console.log('Error:', formData); VM117:1 Error: {name: "tom", email: "", subject: "RE: Hello", message: "Hi!"}

Dawid Adach pro commented 6 years ago

Have you tried used sample files from tutorial itself? Is it also happening with sample code?

Lars7 pro commented 6 years ago

Hi Dawid, Yes, I just downloaded the file and got this error [object Object]. Tom

Dawid Adach pro commented 6 years ago

Dear Tom, you've mentioned that you are running this on your NAS - this is probably the reason why it fails. PHP uses mail() function which requires the server to have the following module loaded. Most probably your NAS doesn't support that. Please try to run it on some web hosting.

Lars7 pro commented 6 years ago

Hi Dawid, Yes, that is why i mentioned the Server as I thought it had something to do with it. I tried your code on a web server and it works fine. I believe it will work on my QNAP but just haven't figured out how yet. Thanks for your help though. Tom

Dawid Adach pro answered 6 years ago

Please add the following to your JS code:
console.log('Error:', data);
and replace data with a variable used for receiving a response from AJAX call. Alternatively, you can try to debug in PHP using

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: Yes