我正在創建一個應用程序,其中頁面內容被更改並通過AJAX(和hashchange jQuery腳本)動態替換。出於某種原因,在動態更改的AJAX內容中,選擇表單選項沒有顯示出來。例如這裏:選擇選項沒有顯示
http://socialbungy.com/newsite/sweeps_temp_facebook/TAB_TEMP1/#enter.php
但是,如果我運行頁面,沒有裝載/改變通過AJAX的內容(除去在URL中的#標記),選擇表單元素的作品,因爲它是應該的。
http://socialbungy.com/newsite/sweeps_temp_facebook/TAB_TEMP1/enter.php
這是我的命!請幫忙。從來沒有遇到過這樣的問題。甚至不知道從哪裏開始。但這裏是我認爲的動態腳本是問題。雖然找不到與選擇框的任何衝突。是什麼賦予了?
$(function() {
var newHash = "",
$mainContent = $("#appContent"),
$pageWrap = $("#page-wrap"),
baseHeight = 0,
$el;
$pageWrap.height($pageWrap.height());
baseHeight = $pageWrap.height() - $mainContent.height();
$("nav").delegate("a", "click", function() {
window.location.hash = $(this).attr("href");
return false;
});
$("#buttonWrap").delegate("a", "click", function() {
window.location.hash = $(this).attr("href");
return false;
});
$(window).bind('hashchange', function(){
newHash = window.location.hash.substring(1);
if (newHash) {
$mainContent
.find("#guts")
.slideToggle(500, function() {
$mainContent.hide().load(newHash + " #guts", function() {
$mainContent.slideToggle(500, function() {
$pageWrap.animate({
height: baseHeight + $mainContent.height() + "px"
});
});
$("nav a").removeClass("current");
$("nav a[href="+newHash+"]").addClass("current");
//RE-FIRE OTHER SCRIPTS ON AJAX CONTENT LOAD
//Phone Field Format
$(function() {
$("#phone").mask("(999) 999-9999",{placeholder:" "});
});
});
});
};
});
$(window).trigger('hashchange');
});
哈,沒有大呼小叫哥們,如果我是它會是我自己。不是我要求幫助的人。 :) – 2012-01-05 21:09:31
這只是一個瘋狂的猜測,但是可能是因爲你的頁面被服務器解釋爲純HTML,而不是PHP?在URL的哈希部分有.php擴展名不會觸發它被服務器解釋爲php。也許如果你使用的主頁是HTML文件,你可以改爲PHP文件。 – 2012-01-05 21:12:31
這並越過我的腦海裏,但我使用這個網頁,這是php以及: http://socialbungy.com/newsite/sweeps_temp_facebook/TAB_TEMP1/#index.php – 2012-01-05 21:17:16