
function fill(wurl){
	
	//	$(wurl).animate({
//$(wurl).parents().find('iframe.tws').hide();

//$('#tws').css('color','#0f0');
//scr=$(wurl).parents().find('#tws');
  //  $(wurl).parents().find('#tws').css("backgroundColor","#000000");

//scr.animate({
   //  "opacity": "1"}, "slow");	
    
    
     // "color": "#ffffff", "opacity": "50"

//alert(wurl.css);

   // }, "slow");	
   //  $(wurl:parent ".ftrty").css("font-weight","normal"); 
  // $(".ftrty").css("backgroundColor","");
  // $(".ftrty").css("color","#000000");
  //  $(wurl).parents().find('.ftrty').css("font-weight","normal"); 
    $(wurl).parents().find('.ftrty').css("backgroundColor","");
    $(wurl).parents().find('.ftrty').css("color","#000000");
  // $(wurl).parent().(".ftrty").css("backgroundColor","");
   
   $(wurl).css("backgroundColor","#F6EE7D");
   //$(wurl).css("font-weight","bold"); 
    $(wurl).css("color","#FF0000");  
  //  $("#ajb_4").css(backgroundColor,"#C0C0C0");
  //  $(".ftrty").animate({"top": "+=50px"}, "slow");  
  // $(".ftrty").css("border","5px");  
      // class="ftrty" 
    //wurl.css("border","2px").fadeIn('slow');
   
   //  $(".ftrty").("font-weight","normal");
    
//	 wurl.css("text-decoration",'underline').fadeIn('slow');
   //   wurl.css("text-decoration",'bold').fadeIn('slow');
      
   //  $(wurl).css({cursor:"auto", backgroundColor:"#CC99FF",border:"2px"});
     
 // $(wurl).animate({width: "toggle"}, 1000);

//	alert($(wurl).attr("id"));  //ok

/*

var url=wurl.attr("id");
// var ccc=wurl.css.color; bad

url=url.replace("ajb_","");
  // alert(ccc); //OK
    
	var bg=$("#ftrh").attr("bgcolor");
	
	//alert(bg);
	  
    $("a[id*=ajb]").css("background",bg).css("text-decoration",'none').css("font-weight",'normal').fadeIn('slow');
    $('td>a[id*=ajb]').css("border","2px").fadeIn('slow');
    
     $('td>a[id*=ajb]').css("border","2px").fadeIn('slow');
     
     
 $('td>a[id*=ajb]').css("font-weight","normal").fadeIn('slow');
 
 
   $("#ajb_2").css("font-weight",'normal').fadeIn('slow');
    //wurl.css("text-decoration",'none');
   // wurl.css({background:'#FFFFFF',color:"black"}).fadeIn('slow');
    
  // wurl.css("text-decoration",'underline').fadeIn('slow');
  $("#ajb_"+url.css("font-weight",'bold').fadeIn('slow');
  
  
  
		try
    {
    	
  // ajaxFunction1("showme.php?sh="+url);	
   

    window.status="OK"; 
  return false;   
    }
  catch (e)
    {
    	
  //  ajaxFunction1(wurl);	
	//alert (wurl);
		$('<div id="loading3"  align="center">'+"<br>"+"يوجد خطأ ما عند إستدعاء الطلب !!!<br>"+wurl+"<br>"+e.description +"</div>").insertAfter('#imain');
	$('#imain').html+=(wurl);

					
	}	
	
    */	};	
        
        
    /////////////////////////////////////////////////
    
        
        function fill_this(wurl){
	
	
	
//	alert($(wurl).attr("href"));  ok


var url=wurl.attr("id");
// var ccc=wurl.css.color; bad

url=url.replace("bjx_","");
  // alert(ccc); //OK
    
	var bg=$("#ftrh").attr("bgcolor");
	
	//alert(bg);
	  
    $("a[id*=ajx]").css("background",bg).css("text-decoration",'none').css("font-weight",'normal').fadeIn('slow');
    $('td>a[id*=ajx]').css("border","0px").fadeIn('slow');
    
   $('td>a[id*=bjx_'+url+']').css({background:'#FFFFFF',color:"black"}).fadeIn('slow');

    //wurl.css("text-decoration",'none');
    $('td>a[id*=ajx_'+url+']').css({background:'#FFFFFF',color:"black"}).fadeIn('slow');
    
  // $('td>a[id*=ajx_'+url+']').css("text-decoration",'underline').fadeIn('slow');
  $('td>a[id*=ajx_'+url+']').css("font-weight",'bold').fadeIn('slow');
    $('td>a[id*=ajx_'+url+']').css("border","2px").fadeIn('slow');
  
  
		try
    {
    	
  // ajaxFunction1("showme.php?sh="+url);	
   

    window.status="OK"; 
  return false;   
    }
  catch (e)
    {
    	
  //  ajaxFunction1(wurl);	
	//alert (wurl);
		$('<div id="loading3"  align="center">'+"<br>"+"يوجد خطأ ما عند إستدعاء الطلب !!!<br>"+wurl+"<br>"+e.description +"</div>").insertAfter('#imain');
	$('#imain').html+=(wurl);

					
	}	
		};	

////////////////////////////////////////////////////////////////////// Method 1	


function ajaxFunction1(wurl)
  {
  	
  	//	emsg="<br>"+wurl;   //   to debug
	
	//$('<div id="loading3"  align="center">'+emsg+'</div>').insertAfter('#imain').fadeIn('slow');				
alert(wurl);				
    	
$('.loading').remove();
//newURL = window.location.protocol + "//" + window.location.host + "/" ;
//	alert(wurl);
	
//	wurl=newURL+wurl;
	
$('#wrdbar').fadeTo('slow',".5");

//$('#wrdbar').slideUp('slow');

	var LoadMsg = "<img src='images/tot2.gif' width='50' height='50'><br><blink><font face=tahoma size=1 color=#FF002A>&nbsp;&nbsp;&nbsp;جاري التحميل ...</font></blink><br>"; 	
	
	//  var LoadMsg = "<img id='loading' class='loading' src='images/loading.gif' >"; 

var LoadMsg2 =  "<img id='loading'  src='images/loading.gif' >";  


			//$('.loading').fadeIn('slow',function(){
						
						//   $('.loading2').fadeIn('slow');	
   
       		//	});	
       		//	});
  
  $('.loading').remove();
  
  // $('#imain').slideDown('slow');	
					
		var _Href = wurl;
		var emsg="";
		
			$('<span " class="loading" align="center">'+LoadMsg2+'</span>').insertAfter('#mid_hdr_bnr_R').fadeIn('slow');

	$('<span " class="loading" align="center">'+LoadMsg2+'</span>').insertBefore('#mid_hdr_bnr_L').fadeIn('slow');
		$('#imain').fadeOut('slow',function(){
	
	$('#imain').html("");	
	
//	$('#imain').html(wurl);
		//	$('#spc_title2').html("");	

		
		$('<div id="loading" class="loading" align="center">'+LoadMsg+'</div>').insertBefore('#imain').fadeIn('slow',function(){
		
	
			
				
			jQuery.ajax({
				type:	'GET',
				async: true,
				url:	_Href,
		    //	data:	"ajax=1",
		      //  contentType: "charset=utf-8",  // application/json; 
				dataType:	'html',
				timeout:	45000,
				success: function(data,textstatus){
					
					//	alert("OK");
					
					//	$('#imain').fadeOut('slow',function(){
						$('#loading').fadeIn('fast',function(){
							$('#loading').remove();
								$('.loading').remove();
			
									$('#imain').html(data).fadeIn('fast',function(){
						//	$('#imain').html(wurl);
										//});
							});
							});
					$('#wrdbar').fadeIn('normal');	
					
		//	emsg="<br>"+wurl;   //   to debug
	
	//$('<div id="loading3"  align="center">'+emsg+'</div>').insertAfter('#imain').fadeIn('slow');				
							
						},
				error: function(xhr,textstatus,e){
					
	$('.loading').remove();	
	
alert(e.Message);			

 	emsg="<br>"+wurl;   //   to debug
	
$('<div id="loading3"  align="center">'+emsg+'</div>').insertAfter('#imain').fadeIn('slow');				
 	
    	$('#wrdbar').fadeTo('slow',"1");
	//	$('<div id="loading3"  align="center">'+wurl+'</div>').insertAfter('#imain').fadeIn('slow');
//	$('#imain').html+=(wurl);

  					
				//	alert("Bad");
			$('#loading').remove();
			$('.loading').remove();
						
					$('<div id="loading" class="loading" align="center">'+LoadMsg+'</div>').insertBefore('#imain').fadeIn('slow');
					
						window.status=textstatus;	
		
							$('#loading').fadeOut('slow',function(){
							$('#loading').remove();
					//		alert(textstatus);	
							//	$('#imain').load(wurl);
			
										});
							$('#wrdbar').fadeIn('normal');			
					$('#wrdbar').fadeTo('slow',"1");
						window.status=textstatus+" : "+ xhr.status+"  -  " + xhr.statusText;		
						
						var err = eval("(" + xhr.responseText + ")");
//	alert(err.Message);
	 emsg=err.Message+"<br>"+wurl;
	
	$('<div id="loading3"  align="center">'+emsg+'</div>').insertAfter('#imain').fadeIn('slow');
	//	$('#imain').html(emsg);
		
	$('#loading').remove();	

   
   
  
						
						},
				complete: function(mxhr,textstatus){
		$('#wrdbar').fadeTo('slow',"1");
				$('#wrdbar').fadeIn('normal');
	//	$('.loading').remove();
			
			//	window.status=textstatus;
					},
					beforeSend:	function(mxhr){
	
						
						}	
						
			});
		});
		});	



						

	return false;

 	
};
//////////////////////////////////////////////////////////////////////  Method 2
function ajaxFunction2(url)
  {

  var xmlHttp;
  
  var LoadMsg = "<img id='loading' class='loading' src='images/loading.gif' >"; 

var LoadMsg2 = "<img src='images/tot2.gif' width=35 height=35>"; 

//alert(url) 


$('.loading').remove();
$('.loading2').remove();
		


		
								$('.loading').fadeIn('slow',function(){
						
						   $('.loading2').fadeIn('slow');
   	
	   	 // $('.loading').fadeOut('slow');	 	
						//		$('.loading').remove();		 	
								//	$('.loading2').remove();	 	
							//	$('#imain').html(d).slideUp('slow');
										});	
//$('#imain').html("").fadeOut('normal');	
//	$('#imain').fadeIn('normal');

 window.status="Try other AJAX role"; 
  
  var ua=""; 
  
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    
    ua="ff"
    }
  catch (e)
    {
 
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
     
       
	   
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
  if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
     ua="ie";	
  	}
  	
  	
  //  alert(ua);  
	
//	  alert(navigator.userAgent);	
    
 xmlHttp.onreadystatechange=function()
      {
      	
      if(ua!="ie")
      	
      	{
   
      if(xmlHttp.readyState==4)
        {
        	
        	
        
								
									 $('#imain').html(xmlHttp.responseText).fadeIn('normal',function(){
									 	
								
									
									
								});
							//	});
						//	};	
 

	 
	    window.status="لحظات ! ";
	}		
      		
      		}
      		
      		else
        {
     		
        	
      if(xmlHttp.readyState==4)
        {
 
	 $('#imain').html(xmlHttp.responseText).fadeIn('normal');
	 
	  window.status="تم";   
	}		
      		
      		}
			  
			  	
      if(xmlHttp.readyState==4)
        {
      
        	
        $('.loading').fadeOut('slow',function(){
						
						   $('.loading2').fadeOut('slow');
   	
	   	  $('.loading').fadeOut('slow');	 	
								$('.loading').remove();		 	
									$('.loading2').remove();	 	
							//	$('#imain').html(d).slideUp('slow');
										});	  	
        
//	 $('#imain').html(xmlHttp.responseText).fadeIn('normal');
		  
	//	   $('#imain').fadeIn('normal');
		   
		   	 
			   window.status="تم";   
			 	
        	}
      	
      //	this.bgcolor="#eeee11";
      
      
      if(xmlHttp.readyState==3)
        {
     //  $('#wrdbar').fadeTo('fast',"1"); 
   //	$('#wrdbar').fadeIn('fast'); 
    // document.myForm.write (xmlHttp.responseText) ;
//document.getElementById("txt").innerHTML = xmlHttp.responseText; //value result;
                
      //  document.myForm.txt= (xmlHttp.responseText) ;
   //document.myForm2.time.value+=("/r/t/n//r//t//n");


			 	
				 
				 	
        // document.getElementById("imain").innerHTML=;
          
     //  	$('#imain').fadeIn('slow',function(){
       		
      // 	$('#wrdbar').fadeTo('fast',"1");
      //	$('#imain').slideDown('normal'); });  });  

         
    
       
    
       
       // });
       } 
         if(xmlHttp.readyState==0)
        {
        		xmlHttp.abort();
         window.status="تمت مقاطعة الطلب";
         
        // $('#wrdbar').fadeTo('fast',"1"); 
        }  
     
     
        
       if(xmlHttp.readyState==1)
        {
        
        //	 $('#imain').html("");	
       		$('#imain').fadeOut('slow',function(){
       			
       			
       		    			
       		$('<span " class="loading" align="center">'+LoadMsg+'</span>').insertAfter('#mid_hdr_bnr_R').fadeIn('slow');

	$('<span " class="loading" align="center">'+LoadMsg+'</span>').insertBefore('#mid_hdr_bnr_L').fadeIn('slow');
//	$(LoadMsg).insertAfter('#mid_hdr_bnr').fadeIn('slow');
//		$(LoadMsg).replaceAll('#mid_hdr_bnr').fadeIn('slow');
//	$('#mid_hdr_bnr').wrap($(LoadMsg));prependTo
//	$('#imain').fadeOut('normal');	wrap
//	$('#imain').fadeOut('normal');	


$('<span id="loading2" class="loading2" align="center">'+LoadMsg2+'</span>').insertBefore('#mid_ftr_bnr').fadeIn('slow');
			$('.loading').fadeIn('slow',function(){
						
						   $('.loading2').fadeIn('slow');	
   
       			});	
       			});
	
//	$('#imain').html(wurl);
		//	$('#spc_title2').html("");	
	
	//	$('#imain').fadeOut('normal');
	//	$('#imain').slideUp('normal');
//	$('#imain').fadeTo('normal',".3");

        	
        //	$('#wrdbar').fadeTo('fast',".3"); 
         window.status="تم إرسال الطلب";
        }  
        if(xmlHttp.readyState==2)
        {
        //	$('#wrdbar').fadeTo('fast',".4"); 
       window.status="إستقبال البيانات";
        }  
       
	   if(xmlHttp.readyState==3)
        {
   //  $('#imain').html(xmlHttp.responseText);
        	
      //  	$('#wrdbar').fadeTo('fast',".5"); 
        window.status="لحظات !!! ";
      
	  
	  
	    } 
		
   /*		*/  
      }

     // xxz=1;
    //  var url="./sys2.php";
//url=url+"?x="+xxz; 


xmlHttp.open("GET",url,true);
 
    xmlHttp.send(null); 
  
     //return false;
};
	/*	
			newURL = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;

var strt=_Href.indexOf('?');
var qq=_Href.substring(strt);

if(_Href.indexOf('=')>0)
	{
		var fullurl=newURL+qq;	
				window.location = fullurl;
					alert(fullurl);
				
				}
				
				*/

/*

$(function(){
	var LoadMsg = 'Please Wait ...';
	$('a').click(function(){
		
		
		var hrf = $(this).attr('href');
			alert(hrf);
	//	'#wrdbar
		
		
    	if(!$(this).hasClass("current")) {
		var _Href = $(this).attr('href');
		$('<div id="loading">'+LoadMsg+'</div>').appendTo('body').fadeIn('slow',function(){
			$.ajax({
				type:	'POST',
				url:	_Href,
				data:	"ajax=1",
				dataType:	'html',
				timeout:	5000,
				success: function(d,s){
						$('#loading').fadeOut('slow',function(){
							$(this).remove();
							$('#wrapper').slideUp('slow',function(){
									$(this).html(d).slideDown('slow');
								});
							});
							
							
						},
				error: function(o,s,e){
							window.location = _Href;
						}
			});
		});
		
	alert(_Href);	
        }
		return false;
	});
});




Assumed we have page structures as follow (you can use apache rewrite or IIS rewrite module to make the links more SEO friendly):

	<div id="nav">
	<ul>
		<li><a href="" title="Welcome Home">home</a></li>
		<li><a href="" title="About Me">about</a></li>
		<li><a href="" title="My Services">services</a></li>
	</ul>
	</div>
	<div id="wrapper">
	<!-- CONTENT GOES HERE -->
	</div>

Search Engine Bots will not have a problem to crawl ‘em and they will follow and probably crawl the page based on the “href” attribute value.

Now we add the ajax functionality on each links. Download latest jquery library or used Google ajax library API, then create a .js file, name it ajax.js, then add these codes between the head tags

<script type="text/javascript" src="path/to/jquery.js"></script>
<script type="text/javascript" src="path/to/ajax.js"></script>

Modify the ajax.js like follow:

$(function(){
	var LoadMsg = 'Please Wait ...';
	$('#nav ul li a').click(function(){
    	if(!$(this).hasClass("current")) {
		var _Href = $(this).attr('href');
		$('<div id="loading">'+LoadMsg+'</div>').appendTo('body').fadeIn('slow',function(){
			$.ajax({
				type:	'POST',
				url:	_Href,
				data:	"ajax=1",
				dataType:	'html',
				timeout:	5000,
				success: function(d,s){
						$('#loading').fadeOut('slow',function(){
							$(this).remove();
							$('#wrapper').slideUp('slow',function(){
									$(this).html(d).slideDown('slow');
								});
							});
						},
				error: function(o,s,e){
							window.location = _Href;
						}
			});
		});
        }
		return false;
	});
});

Just that :) , now test your pages, try to disable/enable javascript and see how it works.

    * Search engine bots will crawled your content as normal, because each link has written in semantic html format
    * Any screen readers which has limitation in parsing javascript also will able to load your content
    * What if javascript has enabled and the ajax request return error? well take a look at the ajax error handling, we simply tell the javascript to redirect the page using normal HTTP request

Do you want to see an online demo page? well here it is.

*/
