Sin exito aun, no se si tenga que dar el dato adicional que los eventos son bajo
AJAX
el primero usa este JS
Código Javascript
:
Ver originalvar pid=-1;
var spinner=null;
function thx_common(response)
{
try
{
xml=response.responseXML;
remove=xml.getElementsByTagName('del').item(0).firstChild.data=="1";
lin=document.getElementById('a'+pid);
if (remove) {
table = document.getElementById('thx' + pid);
table.style.display = xml.getElementsByTagName('display').item(0).firstChild.data != 0 ?
'' : 'none';
list = document.getElementById('thx_list' + pid);
list.innerHTML = xml.getElementsByTagName('list').item(0).firstChild.data;
img = document.getElementById('i' + pid);
img.src = xml.getElementsByTagName('image').item(0).firstChild.data;
}
else
{
lin.innerHTML="";
lin.onclick=null;
lin.href="";
lin = null;
}
}
catch(err)
{
alert("an Error had occured please contact administrator")
alert(err);
}
finally
{
spinner.destroy();
spinner=null;
return lin;
}
}
function thx_action(response)
{
lin=thx_common(response)
if(lin!=null)
{
lin.onclick= new Function("","return rthx("+pid+");");
lin.href='showthread.php?action=remove_thank&pid='+pid;
}
}
function rthx_action(response)
{
lin=thx_common(response)
if (lin!=null)
{
lin.onclick = new Function("", "return thx(" + pid + ");");
lin.href = 'showthread.php?action=thank&pid=' + pid;
}
}
function thx(id)
{
if(spinner)
return false;
spinner = new ActivityIndicator("body", {image: "images/spinner_big.gif"});
pid=id;
pb="pid="+pid;
new Ajax.Request('xmlhttp.php?action=thankyou',{method: 'post',postBody:pb, onComplete:thx_action});
return false;
}
function rthx(id)
{
if(spinner)
return false;
spinner = new ActivityIndicator("body", {image: "images/spinner_big.gif"});
pid=id;
b="pid="+pid;
new Ajax.Request('xmlhttp.php?action=remove_thankyou',{method: 'post',postBody:b,onComplete:rthx_action});
return false;
}
el segundo
Código Javascript
:
Ver original<script type="text/javascript">
<!--
var spinner=null;
function hideuntilthanks_reload()
{
b1 = b;
if(spinner){return false;}
this.spinner = new ActivityIndicator("body", {image: "images/spinner_big.gif"});
new Ajax.Request('{$mybb->settings['bburl']}/xmlhttp.php?action=hideuntilthanks_reload&my_post_key='+my_post_key, {method: 'post',postBody:"", onComplete:hideuntilthanks_done});
return false;
}
function hideuntilthanks_done(request)
{
if(this.spinner)
{
this.spinner.destroy();
this.spinner = '';
}
if(request.responseText.match(/<error>(.*)<\/error>/))
{
message = request.responseText.match(/<error>(.*)<\/error>/);
alert(message[1]);
}
else if(request.responseText)
{
$("hide_table").innerHTML = request.responseText;
}
}
-->
</script>
Ambos funcionan con esta linea
Código PHP:
Ver original$post['thanks'] = "<a href=\"\" onclick=\"return hideuntilthanks_reload();\">Recargar Beta </a><a id=\"a{$post['pid']}\" onclick=\"return thx({$post['pid']}); return hideuntilthanks_reload();\" href=\"showthread.php?action=thank&tid={$post['tid']}&pid={$post['pid']}\">
<img src=\"{$mybb->settings['bburl']}/{$theme['imgdir']}/postbit_thx.gif\" border=\"0\" alt=\"$lang->thx_main\" title=\"$lang->thx_main\" id=\"i{$post['pid']}\" /></a>";
Pero solo bajo onclick´s individuales, la idea es que un solo onclick (el que enlaza la imagen) realice ambos eventos
Saludos y disculpas porque de verdad no me manejo NADA en esto de AJAX y javascript