The following code is made of JQuery 1.3. How can i get it to work with the latest version: 1.9.1 I also need it to remove the checked checkbox when the delete link is clicked. I think I should use the remove() function for that.
The checkboxes is like this:
<input type="checkbox" name="prog" value="C">
$(document).ready(function()
{
$("#submit_prog").click(
function()
{
var query_string = '';
$("input[@type='checkbox'][@name='prog']").each(
function()
{
if(this.checked)
{
query_string += "&prog[]=" + this.value;
}
});
$.ajax(
{
type: "POST",
url: "post_prog.php",
data: "id=1" + query_string,
success:
function(t)
{
$("div#content").empty().append(t);
},
error:
function()
{
$("div#content").append("An error occured during processing");
}
});
});
});
EDIT: Can I do this to remove the checkbox on delete:
function(event)
{
if(this.checked)
{
query_string += "&prog[]=" + this.value;
$(this).remove();
}
}