Post JSON with JQuery

Words
6
Reading
1 min
Listen
Play
8y

Send JSON POST data with JQuery:

 $.ajax
    ({
        type: "POST",
        url: 'example.php',
        dataType: 'json',
        async: false,
        contentType: 'application/json',
        data: JSON.stringify({ "myid": 1 , "mydata" : "Hello World!" }),
        success: function () {
                    console.log("Success"); 
        }
    });
        
Post JSON with JQuery | Ecency