Jump to content

[SOLVED] AJAX & PHP Assistance Please?


deth4uall

Recommended Posts

Ok I am using the jQuery platform to pull up pages into a div called "#main_content" via an HREF link on the side bar. works well BUT the links inside the pulled up page do not inherit the same attributes that the others do. Any ideas?

 

<script type="text/javascript">
var $j = jQuery.noConflict();

$j(document).ready(function(){
	$j('#main_content').load('cityhall.php');
	$j('#loading').hide();
	$j('a').click(function() {
		$j("#main_content").slideUp();
		var replacement = $j(this).attr("title"); //The actual page being pulled
		var content_show = $j(this).attr("id"); //using id to send data like "?id=1"
		if (content_show !== "") {
			var giveme = "POST"; //If there was an attribute to put into data:
		} else {
			var giveme = "GET";
		}	
		$j.ajax({
			type: giveme, url: replacement, data: content_show,
			async: true,
			beforeSend: function(){$j("#loading").show("fast");},
			complete: function(){$j("#loading").hide("fast");},
			success: function(html){ //so, if data is retrieved, store it in html
				$j("#main_content").slideDown("slow"); //animation
				$j("#main_content").html(html); //show the html inside #main_content div
		 	}
		});			
	});	
	});

</script>

Link to comment
https://forums.phpfreaks.com/topic/154539-solved-ajax-php-assistance-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.