Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/416.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在单击图像时刷新特定的div_Javascript_Php_Jquery_Css_Ajax - Fatal编程技术网

Javascript 如何在单击图像时刷新特定的div

Javascript 如何在单击图像时刷新特定的div,javascript,php,jquery,css,ajax,Javascript,Php,Jquery,Css,Ajax,我想使用image onclick刷新div。这里我有一个图像,图像id是“sellhide”,还有一个div id是“sellChart”。 代码: 我已经尝试了很多方法,但都不接受脚本。使用jQuery get()方法: 例如: $.get( "ajax/test.html", function( data ) { $( ".result" ).html( data ); alert( "Load was performed." ); }); 您的问题不清楚。您是否在单击事件和a

我想使用image onclick刷新div。这里我有一个图像,图像id是“sellhide”,还有一个div id是“sellChart”。 代码:

我已经尝试了很多方法,但都不接受脚本。

使用jQuery get()方法:

例如:

$.get( "ajax/test.html", function( data ) {
  $( ".result" ).html( data );
  alert( "Load was performed." );
});

您的问题不清楚。您是否在单击事件和ajax调用响应时尝试过ajax调用更改HTML div?$('#sellChart').HTML();将只返回现有的HTML。@jaydeppandya在一个div中我有一些功能。在上面我有图像,但单击图像时我想重新加载整个div。这是错误的$(“#rentChart”).HTML();您需要将其替换为ajax数据,如=>$(“#rentChart”).html(数据);
$(function() { 
      $( '#sellhide' ).on( 'click', function() { 
             $('#sellChart').html(); 
      }); 
 });   
$.get( "ajax/test.html", function( data ) {
  $( ".result" ).html( data );
  alert( "Load was performed." );
});