September 9, 201214 yr Hi everyone, need some help if u can... im currently designing a website for a hotel. I have a 'special offers' page and im trying to call the latest offer and show it on the home page. The script below is pulling every offer and i cant work out how to only pull the 'first' element. Home page - http://garracktemp.c....com/index.html Offers page - http://garracktemp.c...ial-offers.html $(document).ready(function(){ $('#test').load('/Garrack_Hotel/special-offers.html .offer_info_content', '', function(response, status, xhr) { if (status == 'error') { var msg = "Sorry but there was an error: "; $(".content").html(msg + xhr.status + " " + xhr.statusText); } }); }); any help with this would be great as im still getting to grips with js and azax
September 9, 201214 yr Author i think it may be something along those lines, i did think of a first selector but im not sure where to put it within the script. I'll experiment, thanks for your help. Edited September 9, 201214 yr by James Husband
September 9, 201214 yr just viewd the source you need change image src <img src="file:///C|/Users/jM/Desktop/Make Believe Media/Projects/img/photos/thumbs/bedroom.jpg" alt="" width="200" height="134"> Edited September 9, 201214 yr by ELITE
September 9, 201214 yr Author Heres the HTML for the content of the special offers page <div class="offer_info"> <img src="file:///C|/Users/jM/Desktop/Make Believe Media/Projects/img/photos/thumbs/bedroom.jpg" alt="" width="200" height="134"> ** this is what the script is calling ** <div class="offer_info_content"> <h1>Special Offer</h1> <p>Details of special offer....</p> <ul> <li><a href="#">Book Now</a></li> </ul> </div> </div> ** dont want any offer after 1st to be called ** <div class="offer_info"> <img src="file:///C|/Users/jM/Desktop/Make Believe Media/Projects/img/photos/thumbs/bedroom.jpg" alt="" width="200" height="134"> <div class="offer_info_content"> <h1>Special Offer</h1> <p>Details of special offer....</p> <ul> <li><a href="#">Book Now</a></li> </ul> </div> </div> Edited September 9, 201214 yr by James Husband
September 9, 201214 yr Author yeah i know the image src's are wrong at the moment, its only the offer_info_content which is being called. the image below shows the outline of the div
September 9, 201214 yr here you go sorry for late reply been doing dinner and keeping the baby good $(document).ready(function(){ $('#test').load('/Garrack_Hotel/special-offers.html .offer_info_content:first', '', function(response, status, xhr) { if (status == 'error') { var msg = "Sorry but there was an error: "; $(".content").html(msg + xhr.status + " " + xhr.statusText); } }); }); Edited September 9, 201214 yr by ELITE
September 9, 201214 yr Author Thanks Elite youve been a major help, i was putting the :first within ( )'s. looking at it now im almost frustrated i didnt get it.. Thanks again bud
Create an account or sign in to comment