(function($){$.extend({php:function(url,params){$.ajax({url:url,type:"POST",data:params,dataType:"json",beforeSend:function(){return php.beforeSend();},success:function(data,textStatus){return php.success(data,textStatus);},error:function(xmlEr,typeEr,except){return php.error(xmlEr,typeEr,except);},complete:function(XMLHttpRequest,textStatus){return php.complete(XMLHttpRequest,textStatus);}});}});php={beforeSend:function(){return true;},success:function(response,textStatus){for(var i=0;i";var printStr="
"+"
Error in AJAX request"+"
»
"+"
X
"+"
"+"
";printStr+="XMLHttpRequest exchange: ";switch(xmlEr.readyState){case 0:readyStDesc="not initialize";break;case 1:readyStDesc="open";break;case 2:readyStDesc="data transfer";break;case 3:readyStDesc="loading";break;case 4:readyStDesc="finish";break;default:return"uncknown state";} printStr+=readyStDesc+" ("+xmlEr.readyState+")";printStr+="
\n";if(exObj!=false){printStr+="exception was catch: "+except.toString();printStr+="
\n";} printStr+="HTTP status: "+xmlEr.status+" - "+xmlEr.statusText;printStr+="
\n";printStr+="Response text (show more information »):";printStr+="
\n";printStr+="
";printStr+="
";$(document.body).append(printCss);$(document.body).append(printStr);$('#php-error .php-more').hover(function(){$(this).css('background-color','#fff')},function(){$(this).css('background-color','#fee')});$('#php-error .php-more').click(function(){$('#php-error .php-content').slideToggle();});$('#php-error .php-more2').click(function(){$('#php-error .php-content').slideToggle();return false;});$('#php-error .php-close').click(function(){$('#php-error').fadeOut('fast',function(){$('#php-error').remove()})});$('#php-error .php-close').hover(function(){$(this).css('background-color','#fff')},function(){$(this).css('background-color','#fee')});},complete:function(XMLHttpRequest,textStatus){return true;},addMessage:function(data){var message=data.msg||"";var callBackFunc=data.callback||"defaultCallBack";var callBackParams=data.params||{};php.messages[callBackFunc](message,callBackParams);},addError:function(data){var message=data.msg||"";var callBackFunc=data.callback||"defaultCallBack";var callBackParams=data.params||{};php.errors[callBackFunc](message,callBackParams);},addData:function(data){var callBackFunc=data.callback||"defaultCallBack";php.data[callBackFunc](data.k,data.v);},evalScript:function(data){var func=data.foo||'';eval(func);},data:{defaultCallBack:function(key,value){alert("Server response: "+key+" = "+value);}},messages:{defaultCallBack:function(msg,params){alert("Server response message: "+msg);}},errors:{defaultCallBack:function(msg,params){alert("Server response error: "+msg);}}};})(jQuery);