Solved

jquery java

Posted on 2013-02-02
9
217 Views
Last Modified: 2013-02-02
Please can someone give me full complete tutorials of how to open up content in a div on a php page from and existing hyperlink on that page

I need a complete tutorial and demo
I am happy with jquery / java or php

I have been trying for ages but cannot find a good example
0
Comment
Question by:doctorbill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 30

Expert Comment

by:IanTh
ID: 38846503
0
 

Author Comment

by:doctorbill
ID: 38846619
To clarify
When I click on a link on a php page I want that link to open up the content (from a file or database) in a named div on that page
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38846634
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 57

Assisted Solution

by:Julian Hansen
Julian Hansen earned 500 total points
ID: 38846637
Assumes you have included jquery library
<!doctype html>
<html>
<head>
<title>Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
  $('a.link').click(function(e) {
    e.preventDefault();
    $.get($(this).attr('href'),{},function(data) {
       $('#result').html(data);
    }
  });
})</script>
</head>
<body>
<a class="link" href="http://www.somewebsite.com">Click</a>
<div id="result"></div>
</body>
</html>

Open in new window

0
 

Author Comment

by:doctorbill
ID: 38846657
julianH

this script does not open the link in the div - it open it as a separate tab (webpage). I need the content to appear in the actual div
for example, I have made the div in your script 400 px wide. I need the content to occupy that width as a window on the same page
0
 
LVL 57

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 38846731
That is because there is a missing ); in the script - see fixed script below.

<!doctype html>
<html>
<head>
<title>Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
  $('a.link').click(function(e) {
    e.preventDefault();
    $.get($(this).attr('href'),{},function(data) {
       $('#result').html(data);
    }); // <= missing in original script
  });
})</script>
</head>
<body>
<a class="link" href="http://www.somesite.com">Click</a>
<div id="result"></div>
</body>
</html>

Open in new window

0
 

Author Comment

by:doctorbill
ID: 38846804
perfect - thanks a lot
0
 

Author Closing Comment

by:doctorbill
ID: 38846807
solved
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 38846854
You are welcome - thanks for the points.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question