i’m developing a php page that manage the access to some pubs….
right now i’m stuck with one hell of problem.
let me explain….
i have a button that call an ajaxrequest and reload a specific div called #entry
the problem arise when i try to access ther property of #entry AFTER the ajax request.
HTML STRUCTURE
<div id="all">
<div id="prenotazioni" class="mobile-left">
<? CController::renderpartial('_lista'); ?>
</div>
<div id="entry" class="mobile-right" style="width:280px;position:absolute;bottom:0px;right:0px;">
<? CController::renderpartial('_pren'); ?>
</div>
</div>
and the jquery code that have problem is the follow
$(window).scroll(function() {
$("#all").parent("div").find("#entry").css("bottom","");
$("#all").parent("div").find("#entry").css("top", $(window).height() - $("#entry").outerHeight() + $(window).scrollTop() + "px");
});
so until i call the ajax everithing works fine after that nothing…… somebody can help me?????
Thanks
EDITED
jQuery('body').undelegate('#yt0','click').delegate('#yt0','click',function(){jQuery.ajax({'type':'GET','data':{'id_lista':-1},'url':'/mobile/showlista','cache':false,'success':function(html){jQuery("#all").html(html)}});return false;});
_PREN
<div id="tipo"></div>
<input name="report[id_pren]" id="report_id_pren" type="hidden" value=""/>
<div id="ingresso">
<table>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td style="margin-right: 10px;">
<div class="male" >
<span id="male_nr" class="nr">0</span>
</div>
</td>
<td>
<div class="female">
<span id="female_nr" class="nr">0</span>
</div>
<div class="clear"></div>
</td>
</tr>
<tr>
<td style="line-height: 53px;">INGRESSI
<div id="totale_div" style="float:right;">
<span id="totale">0</span>
</div>
</td>
</td>
<td rowspan="2" style="text-align:right;"><input type="image" src="../images/mobile/invio.gif" /></td>
</tr>
<tr>
<td style="line-height: 53px;">
OMAGGI
<div id="omaggi_div" style="float:right;">
<span id="omaggi"> 0</span>
</div>
</td>
</tr>
<tr>
<td style="width:50px;">
<input type="button" id="omgplus" class="omgplus" />
<input type="button"id="omgminus" class="omgminus" />
</td>
</tr>
</table>
</div>
You are replacing the contents of the
#allelement with the returned results from the Ajax call. So both#prenotazioniand#entryget removed from the DOM.Perhaps you need to put the ajax results inside the
#prenotazionielement. If so useGeneral note
should be
because
#allis a container of#entryso you do not need to go further up the DOM hierarchy..