$delete_commant = l(t('X'), $url, array('attributes' =>
array('onclick' => 'return call_ajax(123)')));
wanneer ik alert in de functiedefinitie call_ajax zet, wordt dit gewaarschuwd, dus ga ik verder met het schrijven van de ajax-postmethode, maar wanneer ik klik op de linkpagina die wordt vernieuwd,
Hoe ajax in Drupal te implementeren
function call_ajax(str){alert(str);
var url = "post.php";
var params = "lorem=ipsum&name=binny";
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(params);
}