使用ajax放置HTML选项卡


Put HTML tabs using ajax

我想把使用JQueryUI创建的选项卡放在我现有的HTML页面中。用来显示使用Ajax接收到的HTML内容。但是标签没有正确显示。下面是我的ajax函数

function GetVendorProfile(Category,Business) {
var xmlhttp;    
if ((Category== 0) || (Business == 0))  {
  document.getElementById("ShowVendorProfile").innerHTML="Please select Category";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {     document.getElementById("ShowVendorProfile").innerHTML=
                   xmlhttp.responseText;
    }
  }
if ((Category == "Function Hall") && (Business != 0)){
    xmlhttp.open("GET","vendorprofile.php?Business="+Business,true);
}
xmlhttp.send();
} 

我的vendorprofile.php包含简单的选项卡。请让我知道,如果有任何其他方式显示HTML成功使用ajax

试试Jquery load

你可以很容易地从服务器直接加载到html:

$("#ShowVendorProfile").load("vendorprofile.php?Business="+Business);