I have a json string which I want to send it to servlet when confirmed in an alert box from where it will be posted into a database using my sqlserver. can you please help me with this? following is my ajax code to send to server. What coding do I need to do in server side to post it in to the database.
var a ={
Message:messagecreated,
Type:messageType
} ;
var jsonString=JSON.stringify(a) ;
if(confirm("Do you want to save this message? \n\n"+ jsonString))
{
$(function(){
$.ajax({
type: "POST",
url: "CreateMessage",
async:true,
cache:false,
data: jsonString,
contentType: "application/json",
success: function(response) {
alert(response);
},
error: function(e){
alert('Error: ' + e);
}