Почему в браузерах на движке webkit
этот скрипт выполняется два раза подряд? В других браузерах работает нормально
var jQ = false;
function initJQ() {
if (typeof(jQuery) == 'undefined') {
if (!jQ) {
jQ = true;
document.write('<scr' + 'ipt type="text/javascript" > > >src="http://code.jquery.com/jquery-1.7.0.js"></scr' + 'ipt>');
}
setTimeout('initJQ()', 50);
}
else {
(function($) {
$(function() {
$("#reg-form").on('submit',function(){
var arr = $('#reg-form').serializeArray();
var ok=true;
$.ajax({
url:'index.php?option=com_admin&task=ajaxValidate',
type:'post',
async:false,
data:{'reg_data':arr},
success:function(resp)
{
if(resp=='done')
{
return true;
}
else
{
$('#alert').show();
ok=false;
}
}
});
if(!ok)
return false;
})
})
})(jQuery)
}
}
initJQ();