MC Web Designs
- Joined
- Oct 28, 2010
- Messages
- 888
- Reaction score
- 111
Hi guys, been a while since I posted or really been active however I am in need of a little assistance!
I'm developing a site for a client and they want it built with jQuery, PHP etc and I've encountered a problem.
The website requires them to have personal bios or profiles for the page, but my client does not want the page to re-direct to another page and wants it to grab the information.
I've achieved that easily using "$.get" in jQuery.
However, they also want the URL to change so that it can be referenced in different parts of the website.
I've created functions, defined variables for the URL and used window.location in jQuery to try and achieve this however I've hit a solid wall.
Below is my code
jQuery
PHP (only basic but works)
HTML
Any help would be appreciated, and yes I've searched for this error on Google and stuff but I can't seem to find anything else other than the website I provided (and soundcloud).
I'm developing a site for a client and they want it built with jQuery, PHP etc and I've encountered a problem.
The website requires them to have personal bios or profiles for the page, but my client does not want the page to re-direct to another page and wants it to grab the information.
I've achieved that easily using "$.get" in jQuery.
However, they also want the URL to change so that it can be referenced in different parts of the website.
I've created functions, defined variables for the URL and used window.location in jQuery to try and achieve this however I've hit a solid wall.
You must be registered to see links
- This website produces what I want effectively however I cannot seem to get their code to work on my end. Below is my code
jQuery
Code:
function getBasics() {
url = "profile.php?p=about";
$.get(url, function(data) {
$(".mainContent").html(data);
});
window.location = url;
}
PHP (only basic but works)
PHP:
<?php
error_reporting(0);
if($_GET['p'] == "about") echo "about.";
else echo "no valid p defined, would show feed here then as default.";
?>
HTML
Code:
<div class="main-prof nav">
<ul>
<li><a id="basics" onclick="getBasics()" href="#">Basics</a></li>
<li><a id="feed" onclick="getFeed()" href="profile.php?p=feed">Feed</a></li>
<li><a id="friends" onclick="getFriends()" href="#">Friends</a></li>
<li><a id="media" onclick="getMedia()" href="#">Media</a></li>
<li><a id="interests" onclick="getInterests()" href="#">Interests</a></li>
</ul>
</div>
Any help would be appreciated, and yes I've searched for this error on Google and stuff but I can't seem to find anything else other than the website I provided (and soundcloud).