Ajax提交表单无法使用第一个url app.icontact

Ajax提交表单无法使用第一个url app.icontact,ajax,forms,submit,Ajax,Forms,Submit,我需要将表单详细信息发送到icontact页面,但它不会做什么 这是我的密码 <script> function submitForm() { $.ajax({type:'POST', url: 'https://app.icontact.com/icp/signup.php', data:$('#ContactForm').serialize(), success: function(response) { $('#ContactForm').find('.form_re

我需要将表单详细信息发送到icontact页面,但它不会做什么

这是我的密码

 <script>
function submitForm() {
$.ajax({type:'POST', url: 'https://app.icontact.com/icp/signup.php', data:$('#ContactForm').serialize(), success: function(response) {
    $('#ContactForm').find('.form_result').html(response);
}});

return false;
}
</script>
<script>
function submitForm() {
$.ajax({type:'POST', url: 'zohoprocess.php', data:$('#ContactForm').serialize(), success: function(response) {
    $('#ContactForm').find('.form_result').html(response);
}});

return false;
}
</script>

函数submitForm(){
$.ajax({type:'POST',url:'https://app.icontact.com/icp/signup.php,数据:$(“#ContactForm”).serialize(),成功:函数(响应){
$('#ContactForm').find('.form_result').html(响应);
}});
返回false;
}
函数submitForm(){
$.ajax({type:'POST',url:'zohoprocess.php',data:$('#ContactForm').serialize(),success:function(response){
$('#ContactForm').find('.form_result').html(响应);
}});
返回false;
}

这不需要两个函数。事情越来越复杂了


函数submitForm(){
$.ajax({type:'POST',url:'https://app.icontact.com/icp/signup.php',
数据:$('#ContactForm').serialize(),成功:函数(响应){

$('#ContactForm').find('.form#result').html(响应);
}});
//提醒并检查这里
返回false;
}
确保在单击submit按钮时调用此方法,并且应该这样做。在onSuccess函数中保持警报,以检查响应是否正确。还要再次检查
onSuccess
函数调用中是否存在
div
u试图访问的文件


谢谢。

您可以使用异步请求,如

function SubmitForm()
{ 
var formdata=$('#ContactForm').serialize();
$.ajax({
      type:'POST', 
      url: 'https://app.icontact.com/icp/signup.php',
      data:formdata, 
      success: function(response)
               {
               $('#ContactForm').find('.form_result').html(response);

               $.ajax({
                     type:'POST', 
                     url: 'zohoprocess.php', 
                     data:formdata, 
                     success: function(response)
                             {
                             $('#ContactForm').find('.form_result').html(response);
                             }
                      });

               },
       error: function(xhr, textStatus, errorThrown)
               {
                  alert('request failed');
               }
      }); 
 }

你复制了相同的函数为什么?我想你想通过submitForm()将数据发送到两个不同的URL两次?是的,我想将数据发送到两个不同的URL有没有任何方式我认为你过于复杂了。我从你的脚本中得到的是,第一个函数将注册,第二个函数将显示基于该函数的数据。是的,兄弟,但我需要做这两件事,除此之外还有其他方法吗
    $('#ContactForm').find('.form_result').html(response);
}});
//alert and check here
return false;
}
</script>
function SubmitForm()
{ 
var formdata=$('#ContactForm').serialize();
$.ajax({
      type:'POST', 
      url: 'https://app.icontact.com/icp/signup.php',
      data:formdata, 
      success: function(response)
               {
               $('#ContactForm').find('.form_result').html(response);

               $.ajax({
                     type:'POST', 
                     url: 'zohoprocess.php', 
                     data:formdata, 
                     success: function(response)
                             {
                             $('#ContactForm').find('.form_result').html(response);
                             }
                      });

               },
       error: function(xhr, textStatus, errorThrown)
               {
                  alert('request failed');
               }
      }); 
 }