dp815292 2015-05-25 16:06
浏览 106

AJAX加载方法错误500

I am french, I am working on website optimisation with AJAX but I have a strange error. I explain with code

I am working with php file. In this php file we built a table with id='ajax'

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

This table is feed with php data (echo + html code)

Just aside we have an other php file named ajax_v2.php which normaly feed the table after javascript and AJAX request.

So, I want to use load method from jquery

My js script is here :

<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>

This script is at the end of the first php file.

When I execute this code on FTP session, I am working for a website, the answer is :

GET XHR http://www.next-war.com/2-test/themes/2/ajax_v2.php [HTTP/1.1 500 Internal Server Error 97ms]

Please help me to resolve this problem.

I am sorry for my bad english. And i am a beginner in web programation.

Thank you a lot.

  • 写回答

1条回答 默认 最新

  • dsn46282 2015-05-25 16:48
    关注

    if you want to pass the vars on the url with GET (not recommended) you have to concatenate in this way

     read=1&type=2
    

    but if prefers hide the vars, use the POST method

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

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办