Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

jquery java

Posted on 2013-02-02
9
Medium Priority
?
226 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
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 83

Expert Comment

by:leakim971
ID: 38846634
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 60

Assisted Solution

by:Julian Hansen
Julian Hansen earned 2000 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 60

Accepted Solution

by:
Julian Hansen earned 2000 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 60

Expert Comment

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

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month20 days, 19 hours left to enroll

810 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