I am new to "jQuery ajax",I am sending the request to the server using ajax. I am sending the data ie no, name, class, age as normal parameters. My Requirement is , I want to send the data in JSON format. My code is,
function fun1() {
    $.ajaxSetup({
        jsonp: null,
        jsonpCallback: null
    });
    $.ajax({
        type: 'POST',
        url: 'register.action',
        dataType: 'json',
        data: {
            no: document.getElementById("id1").value,
            name: document.getElementById("id2").value,
            clas: document.getElementById("id3").value,
            age: document.getElementById("id4").value    
        },    
        success: function (data) {    
            printStudentDetails(data);    
        },
        error: function () {
            alert("failure");
        }
    });
}
My server side resource is java.
 
    