0

在我的 index.php 上,我有以下 html 结构

<input type="text"  class="url" id="url" name="url" contenteditable="true"  style=" text-align: left; height: 30px; width:422px; " placeholder="Enter URL ..." onfocus='display();' /></input> //Text box
<div id = "myDiv"> // Div which holds response from ajax call
<input type="submit" class="button" onclick="GetSentiment()" id="GetSentiment" value="Get Sentiment" style="display:none;"/> //Button which call function to perform action

和ajax调用:

function GetSentiment()
        {
  .....
                xmlhttp.onreadystatechange=function()
                {
                    if (xmlhttp.readyState==4 && xmlhttp.status==200)
                    {                       document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
                    }
                }
                xmlhttp.open("POST","data.php",true); ...

data.php 包含这种结果:http: //jsfiddle.net/karimkhan/xftr5/

最初 Button 就在文本框的下方。

单击按钮并执行操作后,来自 data.php 文件的响应位于文本框下方。

所以按钮被隐藏了。相反,我希望它位于 data.php 的响应下方。即下面myDiv

4

0 回答 0