Question

My application based on spring mvc.On my html page im using jquery ajax to send data to server.But it shows some error. That is it shows dataType : 'json' the symbol : is unexpected

$(document).ready(function() {
        $('#decision').click(function(e) {  
            type : 'POST',
            dataType : 'json',
            url : '/RealEstate/ChangeStatus.html',
            data : ({
            id : $("#pid").val()

            });
        });

});
Was it helpful?

Solution

Those properties should be inside an AJAX method, not directly within a click event handler.

Your request should look something like this:

$('#decision').click(function(e) {
    $.ajax({
        type : 'POST',
        dataType : 'json',
        url : '/RealEstate/ChangeStatus.html',
        data : {id : $("#pid").val()}
    });
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top