So atm I have this which does work. Basicaly I want to execute the sendTo php file without changing to the new page. The location will cause my page to go to the php one and I don't want this. From the php page I can redirect it back to the original page, but I don't really like to do that. This is just some code added to an old app, it does not need to be pretty, it needs to work.
function showVal(newVal, taskid){
var sendTo = "update_event.php?id_task=" + taskid + "&done=" + newVal;
document.location.href = sendTo;
}