Ajax表单不提交

时间:2015-05-26 05:31:05

标签: php ajax

Ajax表单未提交。 这是错的吗?请点击

function send_enquiry(url)
{
    if(document.sendenquiry.onsubmit())
      {
        $.ajax({
          type:"POST",
          url:"send.php",
               data:'url='+url+'&action=service_enquiry&name='+$('#name').val()+'&mail='+$('#email').val()+'&phone='+$('#phone').val()+'&msg='+$('#msg').val(),
               success:function(html)
          {
        if(html=='true')
        {
          $('#process').html('');
          alert('Message has been sent to the advertiser !!');
          div_hide();
        }
          },
          beforeSend:function()
          {
        var ajax_image = "<img src='images/loading.gif' alt='Loading...'     style='width:18px; height:18px;' />";
        $('#process').html(ajax_image);     
          }
        })
      }
  }

Ajax表单未提交。

1 个答案:

答案 0 :(得分:1)

更改此行:

data:'url='+url+'&action=service_enquiry&name='+$('#name').val()+'&mail='+$('#email').val()+'&phone='+$('#phone').val()+'&msg='+$('#msg').val(),

data:{url:url,action:service_enquiry,name:('#name').val(),mail:('#email').val(),phone:$('#phone').val(),msg:$('#msg').val()},