2

How to send multiple data with java script in ajax and redirect it to a welcome page like if i have a function.. script.js

function senddata()
{
//ajax code here 
}

action.php

echo $_POST['username'];

//after successfully meats the value from my database, then it should be redirect to my welcome.php, it is not make possible. Please help me out in the same,

  • 1
    Possible duplicate of [How to make an AJAX call without jQuery?](http://stackoverflow.com/questions/8567114/how-to-make-an-ajax-call-without-jquery) – jeffjenx Apr 28 '16 at 19:23

1 Answers1

0
<script>
  $(document).ready(function(){
    $('#myform').on("submit",function(e){
      e.preventDefault();

      alert("ok");
      var form = $('#myform').serialize();

      $.ajax({
        url:"insert.php",
        type:"post",
        data: form,
        success:function(){
          alert("ok");
        }
      });
    });
  });
</script>
Partho63
  • 3,117
  • 2
  • 21
  • 39