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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.