I have a ajax call to insert some data into database. The below code is jquery get method.
$('#create').click(function(event) {
var course = $('#course').val();
var level = $('#level').val();
var question = $('#question').val();
var option1 =$('#option1').val();
var option2=$('#option2').val();
var option3=$('#option3').val();
var option4=$('#option4').val();
var answer=$('#answer').val();
alert(course+" "+level+" "+question+" "+option1+" "+option2+" "+option3+" "+option4+" "+answer);
$.get('AddQuestion', { course : course, level : level, question : question, option1 : option1, option2 : option2, option3 : option3, option4 : option4, answer : answer }, function(responseText) {
/* if(responseText==="success"){
alert("Question added");
}
else{
alert("Question is not added");
} */
alert(responseText);
});
cal();
});
In my java servlet code after data insertion i worte like below.
response.getWriter().append("success");
when i get response as success i would like to show a alert in jsp as data successfully inserted as shown in above commented code.
But it isn't working.
How can i show alert box with success message ?
any idea thanks in advance..