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表单未提交。
答案 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()},