AJAX加载方法错误500

时间:2015-05-25 16:06:25

标签: javascript php jquery mysql ajax

我是法国人,我正在使用AJAX进行网站优化,但我有一个奇怪的错误。我用代码解释

我正在使用php文件。在这个php文件中,我们构建了一个id ='ajax'

的表
<table id='ajax' width='100%'> <!-- On cré un nouveau tableau qui prend toute la largeur de la page -->

此表是使用php数据(echo + html代码)

提供的

我们还有一个名为ajax_v2.php的其他php文件,它在javascript和AJAX请求后正常提供表格。

所以,我想使用jquery

中的load方法

我的js脚本在这里:

<script src="js/jquery-last.js"></script>
<script>
     function ajax(id,type)
     {
         var param = 'read=' + id + ',type=' + type;
         $("#ajax").load("themes/2/ajax_v2.php",param);
         alert(param);
     }
 </script>

此脚本位于第一个php文件的末尾。

当我在FTP会话上执行此代码时,我正在为一个网站工作,答案是:

  

GET   XHR   http://www.next-war.com/2-test/themes/2/ajax_v2.php [HTTP / 1.1 500内部服务器错误97毫秒]

请帮我解决这个问题。

我很抱歉我的英语不好。我是网络编程的初学者。

非常感谢你。

1 个答案:

答案 0 :(得分:0)

如果你想用GET传递url上的vars(不推荐)你必须以这种方式连接

 read=1&type=2

但如果喜欢隐藏变量,请使用POST方法

  $.post( "ajax_v2.php", { read: "1", type: "2" })
     .done(function( data ) {
           alert( "response: " + data );
     });