Java Script Code Snippet
$(document).ready(function() {
$("#button").click(function(){
$cityName = document.getElementById("name").value;
$.post("AddServlet", {
name:$cityName
}, function(xml) {
$("#feedback").html(
$("result", xml).text()
);
});
});
});
In Servlet
String name= request.getParameter("name");
if (name.equals("shahid")) {
response.setContentType("text/xml");
out.println("<result>You are shahid</result>");
}
else{
response.setContentType("text/xml");
out.println("<result>You are not shahid</result>");
}
This is working fine! but I want to change the background color of div (feedback) accordingly , means if condition true, background color should be Green otherwise background color should be Red (else)
I think XML is used only for carrying data or represent metedata like DTD and so on,
if you want to do something like change your color etc. then you can use
hope this may help you.