Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to set form action via ajax

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 250
    Comment on it

    Hello Reader's If you want to make your form reusable and set the action dynamic via ajax, Then you can make the ajax call like in the example below:-

    <form   id = 'idForm'>

    and the script will go like this

    // this is the id of the form
    $("#idForm").submit(function(e) {
        var url = "action.php"; // the script where you want to put action.
               type: "POST",
               url: url,
               data: $("#idForm").serialize(), // serializes the form's elements.
               success: function(data)
                   alert(data); // show response from the php script.
        e.preventDefault(); // avoid to execute the actual submit of the form.

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: