donglu9896 2014-01-30 05:30
浏览 26
已采纳

Javascript适用于本地服务器,但不适用于实时服务器

I have some website code that I recently uploaded onto my live server and it seems as though my JavaScript function is not working. I searched this site as well as Google and I cannot find a solution, so I am posting this question. I have checked and double checked my directory links and they are being found okay. I did run firebug and it does not post any errors, it's only when I selected the "all" tab is shows me a "500 Internal Server Error". It points me to one line within my JavaScript function, which I've checked to make sure the syntax is correct and it seems good. Again, on my local WAMP server everything works fine, even in firebug it confirms that it works as expected.

Here is the line that firebug points me to:

xmlhttp.send("FLD="+fld+"&TBL="+tbl+"&CAT="+cat+"&ID="+id+"&POS="+pos+"&URL="+url+"&DEL="+del);

It shows that I have all fields present, so everything is being passed to the function okay.

Here is the full function itemDelete() code:

function itemDelete(name,fld,tbl,cat,id,pos,url,del)
{
var check = confirm('Are you sure you want to delete the item "'+name+'" ?');
    if(check === true)
        {
        if (window.XMLHttpRequest)
          {// code for IE7+, Firefox, Chrome, Opera, Safari
          xmlhttp=new XMLHttpRequest();
          }
        xmlhttp.onreadystatechange=function()
          {
          if (xmlhttp.readyState==4 && xmlhttp.status==200)
            {
            window.location.reload();
            // Below is the code needed to retrieve the echo statements from itemMgmt.php
            // Be sure to comment out the reload statment above
            // document.getElementById("response").innerHTML=xmlhttp.responseText;
            }
          }
        xmlhttp.open("POST","/admin/process/itemMgmt.php",true);
        xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        xmlhttp.send("FLD="+fld+"&TBL="+tbl+"&CAT="+cat+"&ID="+id+"&POS="+pos+"&URL="+url+"&DEL="+del);
        }
}

And here is the button code that triggers this function:

<input type="button" style="margin-top:10px;" value="DELETE THIS ITEM" onclick="itemDelete('<?php echo str_replace('_',' ',$music['Item_Name']);?>','Item_ID','music','music','<?php echo $music['Item_ID']; ?>','<?php echo $music['Item_Pos']; ?>','<?php echo $url; ?>','item')">

Once the function itemDelete() is triggered, it goes to itemMgmt.php which actually deletes the item. As far as I can tell the process is not making it to itemMgmt.php.

Any idea?

  • 写回答

1条回答 默认 最新

  • dongzhanlu8890 2014-01-30 05:36
    关注

    You answered yourself: 500 Internal Server Error. Check the server logs.

    It's most likely not related to Javascript, but some configuration issue on the server. Exactly what is impossible to say without details from server logfiles.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器