Php 在ajax调用响应后重新定位主页上的内容
在我的index.php上,我有以下html结构Php 在ajax调用响应后重新定位主页上的内容,php,jquery,html,Php,Jquery,Html,在我的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
<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
data.php包含以下类型的结果:
最初,按钮位于文本框的正下方
单击按钮并执行操作后,来自data.php文件的响应将放置在文本框的正下方
所以按钮被隐藏了。相反,我希望它放在data.php的响应下面。i、 e.下面的
myDiv
如果你有jQuery
为什么不使用$(“myDiv”).load()
?你的div
的样式是怎样的,它是像..
那样关闭的?@RCV:它没有stlye,是的,它的关闭就像你展示的那样@弗里茨万卡潘:对不起,没有jquery@Karimkhan那么为什么要使用jQuery标记呢?
function GetSentiment()
{
.....
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{ document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","data.php",true); ...