addOnload(function()
{
var link = document.getElementById('associateRequests');
var link2 = document.getElementById('associateRequests2');
if (link)
{
link.onclick = function()
{
var uid = link.href.split('=');
uid = uid[1];
ajax.get('/assets/ajax/partner_review.php?uid=' + uid, function(responce)
{
var info = eval('(' + responce + ')');
var i;
lightbox.show(info[0], function(body)
{
for (i = 0; i < info[1].length; ++i)
{
var row = document.createElement('div');
var div1 = document.createElement('div');
var a = document.createElement('a');
var img = document.createElement('img');
var span = document.createElement('span');
var div2 = document.createElement('div');
var div3 = document.createElement('div');
var input1 = document.createElement('input');
var input2 = document.createElement('input');
var requestform = document.createElement('form');
input1.type = 'submit';
input2.type = 'submit';
input1.value = 'Accept';
input2.value = 'Deny';
input1.name = 'acceptrequest[' + info[1][i].uid + ']';
input2.name = 'denyrequest[' + info[1][i].uid + ']';
requestform.name = 'requestform';
requestform.method = 'post';
requestform.action = 'http://mysite.com/home.php';
a.href = 'http://mysite.com/u/' + info[1][i].username;
a.setAttribute('target', '_blank');
addClass(row, 'lb_row');
img.src = info[1][i].avatar;
img.alt = info[1][i].displayName;
row.appendChild(div1);
a.appendChild(img);
div1.appendChild(a);
addClass(div1, 'lb_div');
addClass(div1, 'tdfirst_review');
addClass(img, 'avatar extrasmall vmiddle');
span.appendChild(document.createTextNode(info[1][i].displayName))
a.appendChild(span);
addClass(span, 'lb_span');
div2.appendChild(input1);
row.appendChild(div2);
addClass(div2, 'lb_div_button');
addClass(div2, 'lb_align');
div3.appendChild(input2);
row.appendChild(div3);
addClass(div3, 'lb_div_button');
addClass(div3, 'lb_align');
addClass(div3, 'right');
requestform.appendChild(row);
body.appendChild(requestform);
//requestform.onsubmit = function ()
//{
/* So what to do here, thats the question
- You want to get the data of the button that has been pressed, if such function exists.
- Then use AJAX to send the form data to some file that probably doesnt exist yet.
- Give the PHP a responce, and echot he response to replace the buttons
*/
// input1.onclick = function ()
// {
// alert(input1.name);
// }
// return false;
//}
}
var setClickHandler = function (el, handler) {
return function () {
el.onclick = handler;
return false;
}
};
requestform.onsubmit = setClickHandler(input1, function () {
alert(this.name);
});
});
});
return false;
}
}
});
Bookmarks