我想使用图像onclick刷新div。在这里,我有图像,图片ID是' sellhide',只有一个div id' sellChart'。 代码:
<div class="col-xs-12 col-lg-6 col-sm-6 col-md-6 index_table_three" id="sellChart">
<div class="row" id="title">
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6" id="">
{{ Form::open(array('url' => 'lookup/be-check', 'enctype' => 'multipart/form-data', 'class' => 'form-inline', 'id' => 'sellChartForm')) }}
{{ Form::select('date_time', array($end_date.';'.$today => 'today', $lastWeek.';'.$today => 'Last 7 days', $lastMonth.';'.$today => 'One Month', '' => 'Custom Range'), $end_date.';'.$today, array('id' => 'date_time', 'onchange' => 'GetChangeDate()')) }}
{{ Form::Submit('Apply', array('id' => 'getSellRange', 'class' => 'getSellRange'))}}
{{ Form::close() }}
</div>
<div class="col-xs-4 col-sm-4 col-lg-4 col-md-4" id="">
<h4>Sell property lists</h4>
</div>
<div class="col-xs-2 col-sm-2 col-lg-2 col-md-2" id="">
<img src="<?php echo SITE_PATH . '/mb-images/reset.png' ?>" width="35px;" height="35px;" class="img-responsive center-block" id="sellhide" />
</div>
</div>
<div class="row" id="sellDrawChart">
<h5 style="margin-right:70%;"><b>Property type</b></h5>
<canvas id="sellCanvas" ></canvas>
<h6 style="margin-top:0px;margin-left:80%;"><b>No of property count</b></h6>
</div>
</div>
脚本:
$(function() {
$( '#sellhide' ).on( 'click', function() {
$('#sellChart').html();
});
});
我尝试了许多不接受剧本的方法。
答案 0 :(得分:2)
使用jQuery get()方法: https://api.jquery.com/jquery.get/
例如:
$.get( "ajax/test.html", function( data ) {
$( ".result" ).html( data );
alert( "Load was performed." );
});