Below I have the code on my site, yet when I click on a link in this particular div it just opens a new window, why is this??
$(function(){
//bind a click event to the nav links
$("#links a").bind("click", function(e){
//keep the links from going to another page by preventing their default behavior
e.preventDefault();
//this = link; grab the url
var pageLocation = this.href;
//fire off an ajax request
$.ajax({
url: pageLocation,
//on success, set the html to the responsetext
success: function(data){
$("#biocontent").html(data.responseText);
}
});
});
});
EDIT:
I still havnt figured this out but here is where I am, my script is as follows
<script type="text/javascript">(function(){
//bind a click event to the nav links
$("#links a").bind("click", function(e){
//keep the links from going to another page by preventing their default behavior
e.preventDefault();
//this = link; grab the url
var pageLocation = $(this).attr("href")
//fire off an ajax request
$.ajax({
url: pageLocation,
//on success, set the html to the responsetext
success: function(data){
$("#biocontent").html(data);
},
dataType : "html"
});
});
});
and here is how I am using it in my html<div id="links">
<a href="testvid.html"><img src="img/thumbs/img3.jpg" /></a>
but still no go, please let me know what you think.
EDIT
So I took the minimal parts of this code and moved it into a new doc, and now it doesnt work at all, but i feel like I was having an issue with the Jquery, so now it is work and I am getting this error in the
17XMLHttpRequest cannot load file:///Users/semaj4712/Desktop/WME%20Website/testvid.html. Origin null is not allowed by Access-Control-Allow-Origin.
Which I have no idea what that means, so once I get it working here then I have to tackle the issue with the Jquery on the actual site.
You should call ajax with specified type that you want to get.