Log in

View Full Version : Get content/page load after link click



Rodrigo8
12-18-2014, 05:29 AM
Hello. I am looking to be able to click a link and have a content loading after the click, it does not have to be necessarily another page, truth is it would do best if the opened content can be a php code.

For now i have this example but it does not work. I have no javascript errors on console, and therefore i think it is because of the library, i've used "jquery-1.11.1.min.js", "jquery-2.1.1.min.js" and/or "jquery-latest.js" hosted on my website but it does not work. ¿Which library do i have to use?



<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
function doSomething() {
$.get("somepage.php");
return false;
}
</script>

<a href="#" onclick="doSomething();">Click Me!</a>

I think this code should pass the requested php id that is declared after it to the page that is "getting". (Example: getting for a movie post its respective trailer)
¿How can it be done? ¿Any alternative?

EDIT: I was thinking of something like "if HREF name is '1' > do 'this'" and so on...