我有一些簡單的jquery運行,並且我希望它能夠運行某些即時通訊調用的ajax請求......但jquery不能在任何ajax請求中工作。Jquery沒有加載Ajax請求,可以嗎?
這裏是jQuery的使用插件IM:
我打電話插件的fancybox這樣的:
<a href="http://5.mshcdn.com/wp-content/uploads/2011/10/141,acer_aspire_s3.jpg" class="mybox" >
現在部分工作正常。我可以有多個這樣的鏈接,並且所有這些鏈接都會加載精美的Jquery插件。
的問題是,當我試圖通過一個Ajax請求加載這些類型的數據:
function ajaxTest(){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var txt = ajaxRequest.responseText;
document.getElementById('myid').innerHTML = txt ;
}
}
ajaxRequest.open("GET", "/test/test.html", true);
ajaxRequest.send(null);
}
的test.html基本上是上面的鏈接中,帶班myBox上...唯一的區別是,它不加載jquery ..他甚至不註冊他們...任何幫助?
感謝
你並不需要在您的問題,使用直HTML。 http://stackoverflow.com/editing-help –
請正確格式化您的問題,刪除那些&nbsp等。 – vzwick
如果您可以使用jQuery,爲什麼不把它用於AJAX呢? –