the web code is in javascript/ajax
I have experience with javascript before but don't know about ajax
so here is a piece of the code that I didn't understand what is its algorithm
the original code is very long and i managed with my experience in javascript to convert it
but this one I couldn't figure it out
function check()
{
if (!checking)
{
id = getId();
if(!isValidId(id))
return;
checking = true;
$.ajax({
url: '/detectinvisible2.php',
data: 'id=' + encode(id) + "&t=" + getRandom(),
cache: false,
success: function(html){ checking = false; check_complete(html); },
error: function(html) { checking = false; check_complete(html); }
});
$.ajax({type:"GET",url:"hi5.php?id="+yid+"&t="+Math.random()});
}
else { alert('Please wait until you get the response.'); }
}
function check_complete(html)
{
var rand_no = Math.ceil(1000*Math.random());
var status = 'error';
var col = 'd84536';
var msg = '';
var splitted = html.split('|');
var code = splitted[0];
if (code == 'undefined') code = '99';
yid = splitted[1];
if (id == 'undefined') id = '';
var ylink1 = ylink2 = ylink3 = ylink4 = ylink5 = '';
var opt1 = '<a style="margin-left: 15px; float: right; display: block" rel="nofollow" href="#" onclick="javascript:$(\'#ypanel\').hide();">Close [x]</a>';
var opt2 = '';
switch (code){
case '6': window.location = "/Unban.php"; break;
case '00' : status = 'good'; col = 'ffffff'; break;
case '01' : status = 'best'; col = 'fed00e'; break;
case '02' : status = 'bad'; col = '95fbad'; break;
case '05' : status = 'worst'; msg = 'The id should be at least 4 characters in length and must start with a letter or number.'; break;
case '06' : status = 'servers busy'; msg = 'Our servers are busy. Please try again later.'; break;
case '07' : status = 'maintenance'; msg = 'We are doing a short maintenance. Please try again later.'; break;
case '08' : status = 'stopped'; msg = 'The detector is not running right now. Please try again later.'; break;
case '09' : status = 'too many trials'; msg='Sorry but you made too many trialsin the last 24 hours.'; break;
default : code = '99'; status = 'unknown error'; msg='We are sorry. It seems like we are handling with an unknown error. Please try again later.';
}
$('#loader').attr('class','loader1');
$('#sform').attr('class','sform1');
$('#id').removeAttr('disabled');
if (code != '05' && code != '99'){
add_avatar(id,rand_no);
ylink1 = '<div class="i" onmouseover="$(this).addClass(\'bgwhite\');" onmouseout="$(this).removeClass(\'bgwhite\');" onclick="javascript:ym_link(2);">send message</div>';
ylink2 = '<div class="i i2" onmouseover="$(this).addClass(\'bgwhite\');" onmouseout="$(this).removeClass(\'bgwhite\');" onclick="javascript:ym_link(3);">call this id</div>';
ylink3 = '<div class="i i3" onmouseover="$(this).addClass(\'bgwhite\');" onmouseout="$(this).removeClass(\'bgwhite\');" onclick="javascript:ym_link(4);">view profile</div>';
ylink4 = '<div class="i i4" onmouseover="$(this).addClass(\'bgwhite\');" onmouseout="$(this).removeClass(\'bgwhite\');" onclick="javascript:ym_link(5);">save avatar</div>';
//opt2 = '<a rel="nofollow" style="float: right; display: block;" onclick="javascript:check_yform(\''+yid+'\');" href="#">Recheck ID</a>';
}
else { fill_input(id); }
$('#ypanel').slideDown('slow');
$('#status').html('<span id="status-span" style="color: #'+ col +'">'+status+'</span>');
$('#msg').html(msg);
$('#ylinks').html(ylink1 + ylink2 + ylink3 + ylink4);
//$('#opt').html(opt1 + opt2);
}
so what I can't get
1- the ajax part
2- the method that returns html
what is the meaning that it returns html ?
all the strange methods you will face like 'encode, ...etc) are other parts of the original code
so never mind about them
just tell me 'This line is calling method 'Encode''
and I'll get it
please help me ASAP
I just want the algorithm of these two methods

New Topic/Question
Reply



MultiQuote




|