I'm already using Jquery, so don't really want to use YUI.
How would I do this with Jquery?
Main Topics
Browse All TopicsI'm trying to replicate this effect:
http://www.libraholidays.c
Click on the details and images button under the price, the box is then expanded and the details and images are loaded below.
I realise this is using AJAX, I just need a script where I can use a button to toggle viewing external content from another file.
Can anyone point me in the right direction??
Thanks
Chris
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Jquery - another great library: just as simple: Not tested but this should give you the idea:
Examples:
http://docs.jquery.com/Aja
http://www.ibm.com/develop
Thanks for that. This is what I've got:
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$('detail').click(function
$.post('lettings-detail.as
success: function (o) {
var detailsInfo = o.responseText;
$('detail<%=RS("propID")%>')
});
});
</script>
<a href="#" class="detail">view details</a>
<div id="detail<%=RS("propID")%>"
Is this right? I'm currently getting an error - Line 13 - expected )
Also how would I do it so that it toggles on and off when the button is pressed?
I'm using classic ASP, the part were I refer to lettings-detail.asp?id=<%=R
I used <div id="detail<%=RS("propID")%>"
I've tried your code and I'm still getting an error - Line 13 - expected )
Ok, so now I've got this:
<script type="text/javascript">
$(document).ready(
var propID = document.getElementsByID('
function(){
$.post("lettings-detail.as
},function(txt){
var element = $('detailsInfo');
element.innerHTML = txt;
});
});
</script>
But I'm still getting an error, now on line 10?
The link to expand the text is <a href="#" class="detail">view details</a> and the div is <div id="detailsInfo"></div>, is this right? Where does the ID from the DB get passed?
The expand text functionality was not included. Let me explain what I did:
// wait till DOM is ready:
$(document).ready(
//Request Details Information from my server side Confirm.aspx page
function(){
$.post("Confirm.aspx?comma
},function(txt){
var element = $('detailsInfo');
element.innerHTML = txt;
});
});
//In the above code the "function(txt)" method will capture the results of my server side method call containing the details info
function(txt){
var element = $('detailsInfo'); //get reference to my div element where I want to put the results
element.innerHTML = txt; //assign the text from server side page to my clientside element
});
//clientside asp code
<div id="detailsInfo"></div>
If you want to trigger this on a button click, then you will need to modify the above code to add a button click Event Capture after the dom is ready on a button element. I really don't know why you are getting a syntax error in your javascript, as it worked fine for me on my end. Like I mentioned though, I am not using clasic asp, and am explicitely referencing my html dom elements. If you try to reference aspx dom elements, for instance, you have to be more careful because asp.net changes the name so that can cause some unforeseen errors. If you want to send me your code i'll take a look at what you did.
Ok, thanks, this is what I originally had:
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$('detail').click(function
$.post('lettings-detail.as
success: function (o) {
var detailsInfo = o.responseText;
$('detail<%=RS("propID")%>')
});
});
</script>
<div id="rightcol">
<h2>Lettings</h2>
<p>
<% if RS.eof then %>
</p>
<p class="firstpara">Sorry there are no properties available that meet your search criteria.</p>
<p>Please <a href="javascript:history.b
<% else %>
<% while not RS.eof %>
<% if RS("offline") = 0 then %>
<div class="propbox">
<% if (RS("image1").Value) = "no-image.jpg" then %>
<a href="lettings-display.asp
<% else %>
<a href="lettings-display.asp
<% end if %>
<h3><%=RS("address")%></h3>
<p><%=left (RS("description"),80)%>...
<ul>
<li><%=RS("beds")%> Bedroom</li>
<li><%= FormatCurrency((RS("rent")
<li class="nopad"><a href="#" class="detail">view details</a></li>
</ul>
<div class="cleaner"></div>
<div id="detail<%=RS("propID")%>"
</div>
<% end if %>
<%
RS.movenext
wend
%>
<p><a href="lettings.asp"><< search again</a></p>
<% end if %>
</div>
My lettings-detail.asp page is as follows:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/maltings
<%
Dim RSresults__MMColParam
RSresults__MMColParam = "1"
If (Request.QueryString("id")
RSresults__MMColParam = Request.QueryString("id")
End If
%>
<%
Dim RSresults
Dim RSresults_numRows
Set RSresults = Server.CreateObject("ADODB
RSresults.ActiveConnection
RSresults.Source = "SELECT * FROM qrylettings WHERE propID = " + Replace(RSresults__MMColPa
RSresults.CursorType = 0
RSresults.CursorLocation = 2
RSresults.LockType = 1
RSresults.Open()
RSresults_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm
<html xmlns="http://www.w3.org/1
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Property Sales</title>
<link href="maltings.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<h3><%=(RSresults.Fields.Item
<div id="propimg">
<% if request.querystring("img")
<p><img src="prop-images/<%=(RSresu
<% else %>
<p><img src="prop-images/<%=(RSresu
<% end if %>
</div>
<div id="propdetails">
<p><strong>Area: </strong><%=(RSresults.Fields
<p><strong>Property Type: </strong><%=(RSresults.Fields
<p><strong>Price:</strong> <%= FormatCurrency((RSresults.
<% if RSresults.Fields.Item("ref
<p><strong>Property Reference: </strong>Property <%=(RSresults.Fields.Item("
<% end if %>
<% if RSresults.Fields.Item("ima
<% else %>
<% if request.querystring("img")
<p><strong>Images:</strong> 1 | <a href="lettings-display.asp
<% else %>
<p><strong>Images:</strong> <a href="javascript:history.b
<% end if %>
<% end if %>
<% if request.querystring("img")
<p><a href="mailto:info@mrc-prop
<% else %>
<p><a href="mailto:info@mrc-prop
<% end if %>
</div>
<p>
<% Response.Write Replace(RSresults.Fields.I
</p>
<% if request.querystring("img")
<p><a href="javascript:history.b
<% else %>
<p><a href="javascript:history.g
<% end if %>
</div>
</body>
</html>
<%
RSresults.Close()
Set RSresults = Nothing
%>
woooah.. First time looking at a classic asp page - geez its much different than asp.net he he. I can't even load this in my IDE so I won't be able to help out on that end.
Let me say that I don't believe your javascript is going to work. Reason is you are dynamically generating your id's on your asp page (d=<%=RS("propID")%), which doesn't work the same on the clientside. One think you could try is passing the propID that is clicked to javascript as a parameter.
$('detail').click(function
But this won't work..
$.post('lettings-detail.as
$('detail<%=RS("propID")%>')
Business Accounts
Answer for Membership
by: LeeHenryPosted on 2008-10-29 at 06:16:50ID: 22830707
I suggest you check out the YUI library. http://developer.yahoo.com /yui/ would capture the onclick event of your button, and in my example I call a aspx page, as that is the server side language I chose to get the detail information. You could replace that with a php file if that is your language of choice. when the result of the query comes back, the success handler function will then receive your info, and you can do what you like with it on the client side. In my example I simply embed the content in the innerHTML of one of the divs in my page. Hope this helps.
Their library is easy to use, has great documentation, and some good examples. Here is an example of how you could apply that effect using YUI. The $('details-button).onclick
Select allOpen in new window