Send Contact Details

Lars7 pro asked 7 years ago

Hi,

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

https://mdbootstrap.com/components/bootstrap-contact-form/

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 .


Dawid Adach pro answered 7 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
 var_dump($var)

Lars7 pro answered 7 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: "tom@here.com", subject: "RE: Hello", message: "Hi!"}

Dawid Adach pro commented 7 years ago

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

Tom McMeekin pro commented 7 years ago

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

Dawid Adach pro commented 7 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.

Tom McMeekin pro commented 7 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

Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: Yes