weixin_33726313 2013-01-17 08:39 采纳率: 0%
浏览 35

使用ajax和php获取数据

                <div class="grid--cell fl1 lh-lg">
                    <div class="grid--cell fl1 lh-lg">
                        It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and   cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,   <a href="/help/reopen-questions">visit the help center</a>.

                    </div>
                </div>
            </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2013-01-17 17:58:33Z" class="relativetime">7 years ago</span>.</div>
        </div>
    </aside>

I was doing that when i select a name from combo box then data related to the selected name should be shown from mysql table using ajax. But it could not be done.

<html>
<head>
<script>
function showUser (str)
{
    if(str=="")
    {
        document.getElementById("txtHint").innerHTML=="";
        return;
    }
    if(window.XMLHttpRequest)
    {
        xmlhttp=new XMLHttpRequest();
    }
    else
    {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmltttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("txtHint").innerHTML=xmlhttp.responseText;

        }
    }
    xmlhttp.open("GET","getuser.php?q="+str,true);
    xmlhttp.send();
}
</script>
</head>
<body>
<form>
<select name="users" onchange="""showUser(thiis.value)">
<option value="">Select a person</option>
<option value="1">Peter Griffin</option>
<option value="2">Lois Griffin</option>
<option value="3">Glenn Quagmire</option>
<option value="4">Joseph Swanson</option>
</select>
</form>
<br>
<div id="txtHint">Person List is Here</div>
</body>
</html>

Its shows a notice

</div>
  • 写回答

1条回答 默认 最新

  • weixin_33701617 2013-01-17 08:52
    关注

    That's because you're not reading a CSV file, the byte-pattern of the data you show suggests an OLE wrapper containing BIFF data.... ie. it's probably a genuine Excel .xls file. Try opening the file in MS Excel (rename as .xls if necessary) or Gnumeric or Open/Libre Office Calc.

    To process the file in PHP, you'll need a PHP library capable of reading Excel xls files: in addition to PHPExcel, you can find a list of other libraries here.

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable