Hi
i'd like to know if this code is ok, performant and "good", because if i don't ask for feedback i can't know if there are better methods
Thats a codesnippet from my
linklist l?scht.
it is working perfect, but as i said, i'd like to know if there are better methods
Code:
var dellink;
var link;
function del_link(linkid){
link = linkid;
dellink = new vB_AJAX_Handler(true);
dellink.onreadystatechange(handle_dellink);
dellink.send('linkliste.php?' + SESSIONURL + 'do=del', 'linkid=' + link);
return false;
}
function handle_dellink(){
if (dellink.handler.readyState == 4 && dellink.handler.status == 200)
{
if (dellink.handler.responseXML)
{
var ausgabe = dellink.fetch_data(fetch_tags(dellink.handler.responseXML, 'response')[0]);
if (ausgabe == 'gel?scht')
{
fetch_object("linkspalte_"+link).innerHTML = "";
fetch_object("danieltest").innerHTML="gel?scht";
}
else {
alert("fehler");
}
}
}
}
php part:
PHP Code:
if ($_REQUEST['do']=='del')
{
if (!$show['admincplink'])
{
print_no_permission();
}
$linkid =& $vbulletin->input->clean_gpc('p', 'linkid', TYPE_INT);
$db->query_write("DELETE FROM " . TABLE_PREFIX . "linklist WHERE linklistid = " . $vbulletin->GPC['linkid']);
require_once(DIR . '/includes/class_xml.php');
$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
if ($db->affected_rows())
{
$xml->add_tag('response', 'gel?scht');
}
else
{
$xml->add_tag('response', 'fehler');
}
$xml->print_xml();
}
thx very much