Solved

jquery java

Posted on 2013-02-02
9
218 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

707 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