Question

I have requirement of sending all form parameters as a post request using ajax. and sending a mail of parameters to a Email id.

i am following the below procedure for sending post request on form submission.

  $.ajax({
      type:post
      url:urlfinal,
      success:function(data){
      }
    });

and i am placing mail.php function in action attribute of form element.

But i am facing issue in receiving mail.

So wanted to check whether i can use two url's in a ajax function or do i have to write two ajax functions like below.

$.ajax({
      type:post,
      url:urlfinal,
      success:function(data){
      }
    });
  $.ajax({
      url:mail.php,
      success:function(data){
      }
    });

`

Was it helpful?

Solution

I succeed by using two ajax function one for sending post request and another one is to send a mail like above.

$.ajax({
      type:post,
      url:urlfinal,
      success:function(data){
      }
    });

  $.ajax({
      url:mail.php,
      success:function(data){
      }
    });

but still have doubt why i am facing issue if i use mail.php in action attribute of form element. Any views friends?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top