私は前のhtmlを取得し、次のようにdiv内に再度ロードしようとしています。
$("#start_val").change(function(){
var script = $("#search_result_cont").html();
$("#search_result_cont").empty();
$("#search_result_cont").html(script);
});
ここでは、最初にsearch_result_cont内部htmlをスクリプト変数に入れようとしています。次にempty()関数を使用してsearch_result_cont divを空にし、次に同じhtmlをsearch_result_contに再度挿入しようとしています。しかし、これを行うと、htmlはsearch_result_contdiv内ではなくフルページで表示を開始します
これはsearchresult_contが持っているものです
<div class="search_result_cont" id="search_result_cont">
<script language="javascript">
var offers = <?php echo $jsonencoded;?>;
var node = offers.offer;
var resultpage = parseInt(node.length) / 10;
var result_start = document.getElementById('start_val').value;
var result_limit = parseInt(result_start) + 9;
for(var i=result_start;i<=result_limit;i++)
{
document.write("<div class='result_box'><div class='result_left_area'><div class='result_title'>"+node[i].name+"<div class='result_stars'></div></div><div class='result_pic'><div class='show_image'></div><img src='"+node[i].image_url+"' style='height:100%; width:100%;' /></div><div class='result_icons_cont'><div class='share_icon' title='Share'></div><div class='information_icon' title='information'></div><div class='review_icon' title='Reviews'></div><div class='miles_icon' title='View Location' ></div></div><!--result_icons_cont ends--><div class='result_links_cont'><div class='result_link'>Website 1<span>"+node[i].currency+" "+node[i].price_no_vat+"</span></div></div><div class='view_all_prices'>View all prices from 12 websites <span style='font-size:20px; color:#32ccfe;'>»</span></div></div><div class='result_best_site'><div class='best_site'><img src='images/hotels/267_mx_bg.png' /></div><div class='round_corner_btn' onclick='window.open="+node[i].offer_url+"'></div></div><!--result_best_site ends --><div class='information_cont' id='share_info'>Shares: 6</div><!--information_cont share_info ends--><div class='information_cont' id='information_info'>Hotel Address:- "+node[i].address+","+node[i].city+"<br />Website:- <a href='"+node[i].offer_url+"'>Link</a><br />About:- "+node[i].description+"</div><!--information_cont information_info ends--><div class='information_cont' id='review_info'><input type='hidden' id='review_value' value='' /></div><!--information_cont review_info ends--><input type='hidden' id='lonlat' value='20.63536,476.98787' /><div class='information_cont' id='miles_info'></div><!--information_cont miles_info ends--><input type='hidden' id='picture_count' value='' /><input type='hidden' id='picture_url' value='' /><div class='information_cont' id='images_info'></div><!--information_cont images_info ends--><div class='information_close' title='close'></div></div><!--result_box ends here-->");
}
document.write("<div class='pagination_btn_cont'>");
for(var page = 1;page<=resultpage;page++)
{
document.write("<div class='pagination_btn'>"+page+"</div>");
}
document.write("</div><!--pagination_btn_cont ends-->");
</script>
</div><!--search_result_cont ends here-->