Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.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
Ajax jquery中的javascript在刷新之前不工作_Ajax - Fatal编程技术网

Ajax jquery中的javascript在刷新之前不工作

Ajax jquery中的javascript在刷新之前不工作,ajax,Ajax,我有一个jquery移动页面,里面有JavaScript。问题是除非刷新页面,否则JavaScript无法工作。这是我的密码: <script language="javascript" type="text/javascript"> var url = window.location.search.substring(1); jQuery(function($){ $('#mydiv').load('real_news.asp?'+url);

我有一个jquery移动页面,里面有JavaScript。问题是除非刷新页面,否则JavaScript无法工作。这是我的密码:

<script language="javascript" type="text/javascript">
    var url = window.location.search.substring(1);

    jQuery(function($){
        $('#mydiv').load('real_news.asp?'+url);
    });
</script>

var url=window.location.search.substring(1);
jQuery(函数($){
$('mydiv').load('real_news.asp?'+url);
});

将URL放在jQuery中:

jQuery(function($){
  var url = window.location.search.substring(1);

  $('#mydiv').load('real_news.asp?'+url);
});

在我刷新页面之前仍然无法工作你是否正确关闭了脚本标记?这是我的代码:jQuery(函数($){var url=window.location.search.substring(1);$('#mydiv').load('real#news.asp?'+url);});这背后可能还有其他原因。你能在html文件中提供你的完整代码吗。