<form>
<input type="checkbox" id="m_q" name="m_q" value="271">Name</input><div name="status"></div>
<input type="checkbox" id="m_q" name="m_q" value="271">Age</input><div name="status"></div>
<input type="checkbox" id="m_q" name="m_q" value="271">ID</input><div name="status"></div>
<input type="checkbox" id="m_q" name="m_q" value="271">Emp no</input><div name="status"></div>
<input type="button" value="save" onclick="save" />
</form>
<script>
function save()
{
$.post("/det/save_details/",snddata,
function(data){
if(data == 0 ){
alert('data added');
//How to disable the checkbox field and in the div say data added
},"json");
}
</script>
In the above code after getting the response from the server onselect() ,how to say “data added” in the status div for selected checkbox only
@Haim’s code works but I think he was asking how to add the html to the div based on which checkbox was checked and based on the html he provided, which doesn’t have specific ID’s for the divs, so here is some jquery code that works with the html you have provided. It grabs the checked boxes and disables them, then grabs the next sibling div with name=status to add the html text to it.
You can see a jsFiddle page with an example with your HTML (without the Ajax part and just done in the click event of the button instead).