PHP/Ajax Form Sumission

后端 未结 2 1079
轮回少年
轮回少年 2021-01-26 03:17

I have designed a Sidebar Floating Form with PhP/Ajax which is working and sending submission to my targeted email. Here is the Link: http://logohour.com/form.html but when a v

2条回答
  •  孤独总比滥情好
    2021-01-26 03:52

    First you have to avoid the normal form submission for this form and you can do this by using normal button instead of submit button.

    
    

    Execute a javascript ajax submit code onclick of sendMMessage id. and this will solve your problem.

    Updated answer :

    $( "#target" ).click(function() {
       // put your ajax form submit code here
      $.ajax({
               type: "POST",
               url: 'http://logohour.com/sidebar-form.php',
               data: $("#contact_form").serialize(), // serializes the form's elements.
               success: function(data)
               {
                   console.log(data); // show response from the php script.
               }
             });
    });
    

    If you are still unclear about this I will explain you more detail.

    thanks.

提交回复
热议问题