Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery ajax post form

// this is the id of the form
$("#idForm").submit(function(e) {

    e.preventDefault(); // avoid to execute the actual submit of the form.

    var form = $(this);
    var actionUrl = form.attr('action');
    
    $.ajax({
        type: "POST",
        url: actionUrl,
        data: form.serialize(), // serializes the form's elements.
        success: function(data)
        {
          alert(data); // show response from the php script.
        }
    });
    
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: js pi 
Javascript :: how to add double click event in javascript 
Javascript :: random password javascript 
Javascript :: hello world program in node js 
Javascript :: jquery click on parent but not child 
Javascript :: break camelcase codewars 
Javascript :: javascript change string at particular index 
Javascript :: react chartjs size 
Javascript :: how to find parent table of tr in jquery 
Javascript :: disable autocomplete in react fields 
Javascript :: last field prisma 
Javascript :: how to get file name in directory node js 
Javascript :: js form submit listener 
Javascript :: check for url change js 
Javascript :: unique id generator 
Javascript :: discord.js wait seconds 
Javascript :: check if letter is uppercase javascript 
Javascript :: Typography material ui import 
Javascript :: jquery avoid enter submit 
Javascript :: document delete element 
Javascript :: get current page title javascript 
Javascript :: chartjs start at 0 
Javascript :: ReferenceError: fetch is not defined 
Javascript :: express ejs 
Javascript :: js how to convert all string in array into integer 
Javascript :: how to check nan in jquery 
Javascript :: js get hh mm ss 
Javascript :: specify parameter type in javascript vscode 
Javascript :: jquery in checkbox checked 
Javascript :: angular reactive form remove validation 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =