-ZN-
lundi 12 mai 2008 à 20:01
Ok c'est un peu compliqué mais je vais coller mon code, sans adaptation
déjà, la partie html
CODE
<span id="blog6142" name="blog6142"> <a href="admin/validate-blog.php?blogAddress=lijlkj.com&blogID=6143#" onclick="deleteblog(6142)">delete</a></span>
Puis toute la partie javascript (je ne colle pas le code php, en gros il renvoit une chaine de caractères)
CODE
function deleteblog(blogID){
if (confirm('Are you sure you want to delete this blog?'))
{
var xhr = getXhr();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4 && xhr.status == 200){
msg = xhr.responseText;
myspan='blog'+blogID.toString();
document.getElementById(myspan).innerHTML = msg;
}
}
xhr.open("POST","admin/delete-blog.php",true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.send("blogID="+blogID);
}
}
edit: petite erreur réparée