doupiai5597 2015-08-20 13:24
浏览 35

Ajax错误没有错误

I have an ajax script who use jquery and look like that :

$('#myButton').click(function()
    {
        $.ajax({
            url : "sqlScript.php",
            type : 'POST',
            data : '',
            dataType : 'html',
            beforeSend : function(newRequest,opts)    
            {           
                $('#myButton').attr("disabled", "disabled");
            },
            success : function(code_html, statut)
            {
                location.reload();
            },
            error : function(resultat, statut, erreur)
            {
                alert('error')
                location.reload();
            }
        });
    })

And in my sqlScript.php i have nothing like that :

require_once('bdd.php');

$req= $bdd->query("UPDATE ".$table1
                              ." JOIN ".$table2
                              ." ON ".$table1.".".$field1." = ".$table2.".".$field1
                              ." AND ".$table1.".".$field2." = ".$table2.".".$field2
                              ." SET ".$table2.".".$field3." = ".$table2.".".$field3
                           );
echo "OK";

And each time i click on the button with id 'myButton' the ajax launch the script but at the end of the script it don't pass in the success but in the error and i don't don't why. More weird : their is no error, i mean the script finish well and my UPDATE is completly done.

But this UPDATE is really long something like 10 minutes ... so peraphs it's because of that.

======== EDIT ========

In bdd.php i only have the define of my database :

$host = "localhost";
$db_name = "db";
$user = "root";
$password = "";

try
{
   $bdd = new PDO('mysql:host='.$host.';dbname='.$db_name.';charset=latin1', $user, $password);
}
catch (Exception $e)
{
        die('Erreur : ' . $e->getMessage());
}

$table1 = 'table1';
$table2 = 'table2';
$field1 = 'field1';
$field2 = 'field2';
$field3 = 'field3';
  • 写回答

1条回答 默认 最新

  • douwei1930 2015-08-20 15:02
    关注

    It was a problem of timeout just add this line set_time_limit(0); and it's work.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度