bluviaggiatore free asked 6 years ago


I have applied contact form tutorial ( https://mdbootstrap.com/components/bootstrap-contact-form/#jsvalidation)  and It worked well , but ı have 2 issues with it , 1- after user filling form , ı receive below picture , when user put his name , name text sticks on the form . user filled information and this create a mess http://prntscr.com/k3vymg 2- After sending mail , user receive confirmation text and form doesnt refresh ,actually for this there was java script code like below , but I didnt understand where ı have to paste it . this one ;
document.getElementById(\\\'status\\\').innerHTML = \\\"Sending...\\\";formData = { \\\'name\\\' : $(\\\'input[name=name]\\\').val(), \\\'email\\\' : $(\\\'input[name=email]\\\').val(), \\\'subject\\\' : $(\\\'input[name=subject]\\\').val(), \\\'message\\\' : $(\\\'textarea[name=message]\\\').val()};$.ajax({url : \\\"mail.php\\\",type: \\\"POST\\\",data : formData,success: function(data, textStatus, jqXHR){ $(\\\'#status\\\').text(data.message); if (data.code) //If mail was sent successfully, reset the form. $(\\\'#contact-form\\\').closest(\\\'form\\\').find(\\\"input[type=text], textarea\\\").val(\\\"\\\");},error: function (jqXHR, textStatus, errorThrown){ $(\\\'#status\\\').text(jqXHR);}});
 COPY CODE  thank you very much

Anna Morawska staff commented 6 years ago

Hello bluviaggiatore, have you tried to download source files available on tutorial page? The code which you provided makes an ajax call to mail.php page. Do you have this file in your directory? It is crucial, in ajax call there is a part which is waiting for success response from mail.php, and only then it will reset the form. Best, Anna


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Opened

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: Yes
  • Provided link: No
Tags